diff options
author | Richard Smith <richard@metafoo.co.uk> | 2019-10-22 17:44:08 -0700 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2019-10-22 18:16:17 -0700 |
commit | d052a578de58cbbb638cbe2dba05242d1ff443b9 (patch) | |
tree | 2f3ed903007c6a0459234ce4d05c40e8a33889a6 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 437e0e5191ca255db27e86d232020844c1fd08c8 (diff) | |
download | bcm5719-llvm-d052a578de58cbbb638cbe2dba05242d1ff443b9.tar.gz bcm5719-llvm-d052a578de58cbbb638cbe2dba05242d1ff443b9.zip |
[c++2a] Allow comparison functions to be explicitly defaulted.
This adds some initial syntactic checking that only the appropriate
function signatures can be defaulted. No implicit definitions are
generated yet.
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index d1ad304e62e..31a4302ba82 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2049,6 +2049,11 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, } } + if (D->isExplicitlyDefaulted()) + SemaRef.SetDeclDefaulted(Function, D->getLocation()); + if (D->isDeleted()) + SemaRef.SetDeclDeleted(Function, D->getLocation()); + if (Function->isLocalExternDecl() && !Function->getPreviousDecl()) DC->makeDeclVisibleInContext(PrincipalDecl); @@ -2056,7 +2061,6 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, PrincipalDecl->isInIdentifierNamespace(Decl::IDNS_Ordinary)) PrincipalDecl->setNonMemberOperator(); - assert(!D->isDefaulted() && "only methods should be defaulted"); return Function; } @@ -4016,9 +4020,6 @@ void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation, bool TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, FunctionDecl *Tmpl) { - if (Tmpl->isDeleted()) - New->setDeletedAsWritten(); - New->setImplicit(Tmpl->isImplicit()); // Forward the mangling number from the template to the instantiated decl. |