diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-07-06 15:46:09 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-07-06 15:46:09 +0000 |
commit | 19f74acdf8842ceece578b7307884f5ba22d7f59 (patch) | |
tree | 7466c9a1339d1e88e038553b850cd4c35b0090f8 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | caf01c5483d0c2f8542d1e18ca6213dc6d0e54bf (diff) |
Use attributes from the definition (if available) when
instantiating functions.
Fixes PR10272.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134491 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 0a05d0e304..29385e50b8 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -59,7 +59,7 @@ bool TemplateDeclInstantiator::SubstQualifier(const TagDecl *OldDecl, // FIXME: Is this still too simple? void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, - Decl *Tmpl, Decl *New) { + const Decl *Tmpl, Decl *New) { for (AttrVec::const_iterator i = Tmpl->attr_begin(), e = Tmpl->attr_end(); i != e; ++i) { const Attr *TmplAttr = *i; @@ -2283,7 +2283,12 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, EPI)); } - SemaRef.InstantiateAttrs(TemplateArgs, Tmpl, New); + const FunctionDecl* Definition = Tmpl; + + // Get the definition. Leaves the variable unchanged if undefined. + Tmpl->isDefined(Definition); + + SemaRef.InstantiateAttrs(TemplateArgs, Definition, New); return false; } |