]> granicus.if.org Git - clang/commit
Allow sizeof(UnrelatedClass::field) in C++11 class template methods
authorReid Kleckner <rnk@google.com>
Fri, 11 Mar 2016 18:59:12 +0000 (18:59 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 11 Mar 2016 18:59:12 +0000 (18:59 +0000)
commite4193c5ff01b3e3ef48a2c501e07eaa88683f885
tree19d60d72ea84f2dd4cb37001ecb4f65dff633803
parent0a5490e174e79614f4b8e98a8091ad3b86d043a2
Allow sizeof(UnrelatedClass::field) in C++11 class template methods

This feature works outside of templates by forming a DeclRefExpr to a
FieldDecl instead of a MemberExpr, which requires a base object in
addition to the FieldDecl.

Previously, while building up the template AST before instantiation, we
formed a CXXDependentScopeMemberExpr, which always instantiates to a
MemberExpr. Now, in unevaluated contexts we form a
DependentScopeDeclRefExpr, which is a more flexible node that can
instantiate to either a MemberExpr or a DeclRefExpr depending on lookup
results.

Fixes PR26893.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263279 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaTemplate.cpp
test/SemaTemplate/instantiate-sizeof.cpp