[cfe-dev] dependent scope expr weirdness

Abramo Bagnara abramo.bagnara at gmail.com
Thu Mar 3 07:14:56 PST 2011


Il 03/03/2011 15:42, Douglas Gregor ha scritto:
> 
> On Mar 3, 2011, at 3:58 AM, Abramo Bagnara wrote:
> 
>>
>> template <typename T>
>> struct s {
>>  s() {
>>    T::x = 0;
>>  }
>> };
>>
>> template <typename T>
>> void f() {
>>  T::x = 0;
>> }
>>
>> In this snippet the first x is mapped to a CXXDependentScopeMemberExpr
>> while the second is mapped to a CXXDependentScopeDeclRefExpr.
>>
>> There is a reason underlying this incongruency?
> 
> Yes. T::x within the non-static member function might be a reference to a non-static member of a base class 'T', which would be an access with an implicit 'this'. We don't know until instantiation time.

Not in this specific case, but in general this might happen.

Thanks for explaining.



More information about the cfe-dev mailing list