diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-10-23 17:07:16 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-10-23 17:07:16 +0000 |
commit | 0661bd0ccae381613c5967cdf2514255e1f92636 (patch) | |
tree | 6fa395be33656e24b544f83accf2f2f9695e4b10 /lib | |
parent | 59283a001cf2b8f7aea90b2cac48b457dc531ef4 (diff) |
Attach class template attributes to the templated CXXRecordDecl,
instead of silently discarding them.
As a side effect, this improves diagnostics for constexpr class
templates slightly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 289ec1a6f6..2241024ba4 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2312,7 +2312,10 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, // Note that the above type specs guarantee that the // type rep is a Decl, whereas in many of the others // it's a Type. - Tag = dyn_cast<TagDecl>(TagD); + if (isa<TagDecl>(TagD)) + Tag = cast<TagDecl>(TagD); + else if (ClassTemplateDecl *CTD = dyn_cast<ClassTemplateDecl>(TagD)) + Tag = CTD->getTemplatedDecl(); } if (Tag) |