diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 13 | ||||
-rw-r--r-- | lib/Sema/SemaExceptionSpec.cpp | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 1da1884752..d986635746 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -4372,9 +4372,15 @@ void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) { if (Type->hasExceptionSpec()) { // Delay the check if this is the first declaration of the special member, // since we may not have parsed some necessary in-class initializers yet. - if (First) + if (First) { + // If the exception specification needs to be instantiated, do so now, + // before we clobber it with an EST_Unevaluated specification below. + if (Type->getExceptionSpecType() == EST_Uninstantiated) { + InstantiateExceptionSpec(MD->getLocStart(), MD); + Type = MD->getType()->getAs<FunctionProtoType>(); + } DelayedDefaultedMemberExceptionSpecs.push_back(std::make_pair(MD, Type)); - else + } else CheckExplicitlyDefaultedMemberExceptionSpec(MD, Type); } @@ -11018,6 +11024,9 @@ void Sema::SetDeclDefaulted(Decl *Dcl, SourceLocation DefaultLoc) { // on it. Pattern->isDefined(Primary); + // If the method was defaulted on its first declaration, we will have + // already performed the checking in CheckCompletedCXXClass. Such a + // declaration doesn't trigger an implicit definition. if (Primary == Primary->getCanonicalDecl()) return; diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp index ab8dcd1ad4..26c3d354c7 100644 --- a/lib/Sema/SemaExceptionSpec.cpp +++ b/lib/Sema/SemaExceptionSpec.cpp @@ -124,7 +124,7 @@ Sema::ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT) { return SourceFPT; // Compute or instantiate the exception specification now. - if (FPT->getExceptionSpecType() == EST_Unevaluated) + if (SourceFPT->getExceptionSpecType() == EST_Unevaluated) EvaluateImplicitExceptionSpec(Loc, cast<CXXMethodDecl>(SourceDecl)); else InstantiateExceptionSpec(Loc, SourceDecl); |