diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-11-02 00:47:52 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-11-02 00:47:52 +0000 |
| commit | a0fe8a324e3794fa9e2a7c4a707dfe1cfdd4a39e (patch) | |
| tree | 0c7e765b6f8af21e0a6ff3a8692801c72dd9a88e /clang/lib/Sema/SemaDecl.cpp | |
| parent | ae8e12e79f8dd158a1cadabc51c27c109f0f6f93 (diff) | |
| download | bcm5719-llvm-a0fe8a324e3794fa9e2a7c4a707dfe1cfdd4a39e.tar.gz bcm5719-llvm-a0fe8a324e3794fa9e2a7c4a707dfe1cfdd4a39e.zip | |
More forcibly resolve exception specifications when checking a function
redeclaration in C++1z mode. We need the exception specification in order for
the function's type to be complete.
llvm-svn: 285779
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 319e63dbb18..1813aa0b648 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2949,6 +2949,15 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, // but do not necessarily update the type of New. if (CheckEquivalentExceptionSpec(Old, New)) return true; + // If exceptions are disabled, we might not have resolved the exception spec + // of one or both declarations. Do so now in C++1z, so that we can properly + // compare the types. + if (getLangOpts().CPlusPlus1z) { + for (QualType T : {Old->getType(), New->getType()}) + if (auto *FPT = T->getAs<FunctionProtoType>()) + if (isUnresolvedExceptionSpec(FPT->getExceptionSpecType())) + ResolveExceptionSpec(New->getLocation(), FPT); + } OldQType = Context.getCanonicalType(Old->getType()); NewQType = Context.getCanonicalType(New->getType()); |

