[cfe-dev] Missing lvalue-to-rvalue cast for first arg of ->* ?

John McCall rjmccall at apple.com
Thu Jun 30 10:16:01 PDT 2011


On Jun 30, 2011, at 1:55 AM, Enea Zaffanella wrote:
> When dumping the AST for the following C++ program:
> 
> struct B { int mem; };
> 
> void foo(B* pb, int B::* pmem) {
>  pb->mem;
>  pb->*pmem;
> }
> 
> it can be seen that the lvalue pointer pd, when used as the first
> argument of MemberExpr pb->mem, is subject to an LValueToRValue implicit
> cast.
> 
> This is not the case when pb is used as the first argument in the
> member-pointer operator ->*.
> 
> Similarly, lvalue member-pointers (such as pmem) occurring as the second
> argument of ->* and .* operators are not subject to LValueToRValue
> implicit casts.
> 
> Is this difference meant (and why)?

No, it isn't.  Thanks for pointing it out;  fixed in r134170.

John.



More information about the cfe-dev mailing list