[Bug c++/38612] Vague error diagnostics for pointer-to-member type incompatibility
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 30 14:18:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38612
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-05-30
CC| |jason at gcc dot gnu.org,
| |manu at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I agree the diagnostic could be much better but I'm not fully convinced by your
proposal.
Clang++ says:
pr38612.cc:7:16: error: left hand operand to ->* must be a pointer to class
compatible with the right hand operand, but is 'X'
return object->*p2m;// fails because X is incomplete
^
pr38612.cc:2:8: note: forward declaration of 'X'
struct X;// X derived from Base later but incomplete here
^
pr38612.cc:21:16: error: left hand operand to ->* must be a pointer to class
compatible with the right hand operand, but is 'Y *'
return object->*p2m;// fails because Y is not derived from A
^
which to me is only slightly better.
I think I would like to get:
pr38612.cc:7:16: error: right hand operand 'Base::*' to '->*' is not compatible
with left-hand operand 'X *' because 'X' is not a complete type
return object->*p2m;// fails because X is incomplete
^
pr38612.cc:2:8: note: forward declaration of 'X'
struct X;// X derived from Base later but incomplete here
^
pr38612.cc:21:16: error: right hand operand 'Base::*' to '->*' is not
compatible with left-hand operand 'Y *' because 'Y' is not derived from 'Base'
return object->*p2m;// fails because Y is not derived from A
^
pr38612.cc:3:8: note: 'Y' declared here
struct Y {};// Y not derived from Base
^
What do you think?
Jason?
More information about the Gcc-bugs
mailing list