Consider this example: --
struct Base {}; struct X; // X derived from Base later but incomplete here struct Y {}; // Y not derived from Base int test1(int Base::* p2m, X* object) { return object->*p2m; // fails because X is incomplete } struct X : Base { }; int test2(int Base::* p2m, X* object) { return object->*p2m; // OK } int test3(int Base::* p2m, Y* object) { return object->*p2m; // fails because Y is not derived from A } -- produces the following errors: In function 'int test1(int Base::*, X*)': error: pointer to member type 'int' incompatible with object type 'X' In function 'int test3(int Base::*, Y*)': error: pointer to member type 'int' incompatible with object type 'Y' The error messages could be made more useful to the user by a) including the class type of the pointer to member type or the full p2m type (this might be a bug, depending on whether the programmer's intention was to actually print that instead of the rather uninteresting pointed-to type) b) adding to the message for test1 something that points out that X was incomplete when evaluated. The code in cp/typeck2.c build_m_component_ref() uses a shortcut here to print the identical message for two errors that have very different implications from the user's perspective. -- Summary: Vague error diagnostics for pointer-to-member type incompatibility Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bruck dot michael at googlemail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38612