[cfe-dev] Explicit this expression in class template is dependent?

Jason Haslam jason.haslam at gmail.com
Fri Aug 22 12:56:09 PDT 2014

Hi all,

I find that explicit this expressions in class templates create a CXXDependentScopeMemberExpr in the AST while the equivalent implicit this is a MemberExpr. For example code like this:

template <typename T> struct A {
  int i;
  int getImplicit() { return i; } // MemberExpr
  int getExplicit() { return this->i; } // CXXDependentScopeMemberExpr

Why is explicit dependent? Is it technical (per the language standard) or an implementation detail? I’d like both expressions to resolve to the member for static analysis/refactoring/etc.


More information about the cfe-dev mailing list