aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaExceptionSpec.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-07-12 21:11:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-07-12 21:11:25 +0000
commitb64764a30bcec0cc13fff3eb23aa3664b71ac377 (patch)
tree74109c5c270367cf8050c620c9838f05b22d4a2d /clang/lib/Sema/SemaExceptionSpec.cpp
parentc480f30580ab0f23a4f7c2ac142fd89412e76a41 (diff)
downloadllvm-b64764a30bcec0cc13fff3eb23aa3664b71ac377.zip
llvm-b64764a30bcec0cc13fff3eb23aa3664b71ac377.tar.gz
llvm-b64764a30bcec0cc13fff3eb23aa3664b71ac377.tar.bz2
PR38141: check whether noexcept-specifications are equivalent in redeclarations
llvm-svn: 336946
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r--clang/lib/Sema/SemaExceptionSpec.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index 8dce6d5..df5bc9b 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -530,10 +530,16 @@ static bool CheckEquivalentExceptionSpecImpl(
}
}
- // FIXME: We treat dependent noexcept specifications as compatible even if
- // their expressions are not equivalent.
- if (OldEST == EST_DependentNoexcept && NewEST == EST_DependentNoexcept)
- return false;
+ // C++14 [except.spec]p3:
+ // Two exception-specifications are compatible if [...] both have the form
+ // noexcept(constant-expression) and the constant-expressions are equivalent
+ if (OldEST == EST_DependentNoexcept && NewEST == EST_DependentNoexcept) {
+ llvm::FoldingSetNodeID OldFSN, NewFSN;
+ Old->getNoexceptExpr()->Profile(OldFSN, S.Context, true);
+ New->getNoexceptExpr()->Profile(NewFSN, S.Context, true);
+ if (OldFSN == NewFSN)
+ return false;
+ }
// Dynamic exception specifications with the same set of adjusted types
// are compatible.