diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-03-27 00:22:47 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-03-27 00:22:47 +0000 |
commit | 3901dfe431a87c71592293f579a0ec74633e1ea9 (patch) | |
tree | d2f4da849dbfb0077f22eabdfbce646db29a1fc1 /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | ecafbe60384fa51f6a5188fd0bfaeb2a56273771 (diff) | |
download | bcm5719-llvm-3901dfe431a87c71592293f579a0ec74633e1ea9.tar.gz bcm5719-llvm-3901dfe431a87c71592293f579a0ec74633e1ea9.zip |
PR15597: Fix a confusion between the implicit exception specification and the
uninstantiated exception specification when a special member within a class
template is both defaulted and given an exception specification on its first
declaration.
llvm-svn: 178103
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 1da18847524..d986635746c 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/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; |