This will invoke a runtime cost, though (using dynamic_cast), just so you know.

EDIT: VS and clang seems to disagree:

class BaseClassA
{
};


class BaseClassB