aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-04-10 05:48:59 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-04-10 05:48:59 +0000
commit4841ca5f83bf970f910ac7d154cdd71d2a3cf481 (patch)
treea097f9af29654dc67ebcc7b8616954fc20f77798 /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent7e0c22714e4750a2f730035957f9bb678ae681c0 (diff)
C++11 inheriting constructors: support for inheriting constructor templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179151 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 33e83d07d6..17e3218bff 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1513,6 +1513,10 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
Constructor->isExplicit(),
Constructor->isInlineSpecified(),
false, Constructor->isConstexpr());
+ // Claim that the instantiation of a constructor or constructor template
+ // inherits the same constructor that the template does.
+ if (const CXXConstructorDecl *Inh = Constructor->getInheritedConstructor())
+ cast<CXXConstructorDecl>(Method)->setInheritedConstructor(Inh);
} else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) {
Method = CXXDestructorDecl::Create(SemaRef.Context, Record,
StartLoc, NameInfo, T, TInfo,
@@ -2688,15 +2692,16 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
FunctionDecl *ExceptionSpecTemplate = Tmpl;
if (EPI.ExceptionSpecType == EST_Uninstantiated)
ExceptionSpecTemplate = EPI.ExceptionSpecTemplate;
- assert(EPI.ExceptionSpecType != EST_Unevaluated &&
- "instantiating implicitly-declared special member");
+ ExceptionSpecificationType NewEST = EST_Uninstantiated;
+ if (EPI.ExceptionSpecType == EST_Unevaluated)
+ NewEST = EST_Unevaluated;
// Mark the function has having an uninstantiated exception specification.
const FunctionProtoType *NewProto
= New->getType()->getAs<FunctionProtoType>();
assert(NewProto && "Template instantiation without function prototype?");
EPI = NewProto->getExtProtoInfo();
- EPI.ExceptionSpecType = EST_Uninstantiated;
+ EPI.ExceptionSpecType = NewEST;
EPI.ExceptionSpecDecl = New;
EPI.ExceptionSpecTemplate = ExceptionSpecTemplate;
New->setType(SemaRef.Context.getFunctionType(NewProto->getResultType(),
@@ -2733,7 +2738,6 @@ TemplateDeclInstantiator::InitMethodInstantiation(CXXMethodDecl *New,
if (Tmpl->isVirtualAsWritten())
New->setVirtualAsWritten(true);
- // FIXME: attributes
// FIXME: New needs a pointer to Tmpl
return false;
}