Comment 11 for bug 984577

Revision history for this message
In , Glisse-6 (glisse-6) wrote :

Note: this is very old, I barely remember it.

(In reply to comment #6)
> Sorry, I think your message is not easily understandable. I think you are
> trying to say that "the right hand side must be a pointer-to-member",

No, I think I am saying: hello, this is the left hand side of a ->* operator, and you are feeding me a pointer to member, which obviously should be on the right hand side.

> I like more clang's message:
>
> /tmp/webcompile/_28618_0.cc:4:11: error: right hand operand to ->* has non
> pointer-to-member type 'void ()'
> int i = p ->* f ;
> ^ ~

The testcase in the patch has p ->* p, and clang says:

test.cc:2:11: error: left hand operand to ->* must be a pointer to class
      compatible with the right hand operand, but is 'struct A::*'
int i = p ->* p ; // { dg-error "" }
          ^~~
          .*

(not sure what that .* is doing there)

> I am not saying that you need to print the type or fix the location (it would
> be nice but I understand it is quite extra work, and could be done later). But
> the text could say: "type of right-side operand of %<->*%> is not
> pointer-to-member", or "right-side operand of %<->*%> has non pointer-to-member
> type" or "right-side operand of %<->*%> must have pointer-to-member type".

IIRC (and I could be wrong), this test is really about the lhs. Which doesn't mean that the error message is good...