[cfe-dev] dependent scope expr weirdness
Douglas Gregor
dgregor at apple.com
Thu Mar 3 06:42:44 PST 2011
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.
- Doug
More information about the cfe-dev
mailing list