diff options
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 8dce6d59c60..df5bc9b82b9 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. |

