Muokkaa

Jaa


Compiler Warning C5243

'type': using incomplete class 'class-name' can cause ODR violation due to ABI limitation. You can workaround the issue by specifying inheritance keyword on the forward declaration of the class.

Remarks

The Microsoft C++ ABI uses more than one kind of pointer-to-member type. These types have different sizes that depend on the inheritance model used by the class. The C++ standard allows you to declare a pointer-to-member of an incomplete class type. If you declare a variable of pointer-to-member type for an incomplete class, the compiler must use the most general representation. It can lead to a one definition rule, or ODR violation, since the compiler may use a smaller, more specific representation for this pointer-to-member type in other translation units where the complete class type is available.

To resolve this error, you can specify the complete class type before you declare the pointer-to-member variable. Or, use a Microsoft-specific inheritance keyword to specify the correct inheritance model on the incomplete forward class declaration.

Compiler Warning C5243 is new in Visual Studio 2019 version 16.10 and is off by default. For more information on how to enable this warning, see Compiler warnings that are off by default.

See also

Inheritance keywords