diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-07 02:33:37 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-07 02:33:37 +0000 |
commit | c3d2ebb60f6048cf99a5c30ce77b9ec9118b635b (patch) | |
tree | 097f01e3d2d992fa92d4396cd9c85b84ae9227ea /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | a1acb49188281013ca1eea3ab1b758f1adef0377 (diff) | |
download | bcm5719-llvm-c3d2ebb60f6048cf99a5c30ce77b9ec9118b635b.tar.gz bcm5719-llvm-c3d2ebb60f6048cf99a5c30ce77b9ec9118b635b.zip |
PR16243: Use CXXThisOverride during template instantiation, and fix up the
places which weren't setting it up properly. This allows us to get the right
cv-qualifiers for 'this' when it appears outside a method body in a class
template.
llvm-svn: 183483
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 60f447711e2..5e3ced47f44 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2080,6 +2080,14 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, E = LateAttrs.end(); I != E; ++I) { assert(CurrentInstantiationScope == Instantiator.getStartingScope()); CurrentInstantiationScope = I->Scope; + + // Allow 'this' within late-parsed attributes. + NamedDecl *ND = dyn_cast<NamedDecl>(I->NewDecl); + CXXRecordDecl *ThisContext = + dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext()); + CXXThisScopeRAII ThisScope(*this, ThisContext, /*TypeQuals*/0, + ND && ND->isCXXInstanceMember()); + Attr *NewAttr = instantiateTemplateAttribute(I->TmplAttr, Context, *this, TemplateArgs); I->NewDecl->addAttr(NewAttr); |