diff options
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 3a32754..246d231 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -5779,7 +5779,8 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, QualType LhsT, return Self.Context.typesAreCompatible(Lhs, Rhs); } case BTT_IsConvertible: - case BTT_IsConvertibleTo: { + case BTT_IsConvertibleTo: + case BTT_IsNothrowConvertible: { // C++0x [meta.rel]p4: // Given the following function prototype: // @@ -5840,7 +5841,13 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, QualType LhsT, return false; ExprResult Result = Init.Perform(Self, To, Kind, FromPtr); - return !Result.isInvalid() && !SFINAE.hasErrorOccurred(); + if (Result.isInvalid() || SFINAE.hasErrorOccurred()) + return false; + + if (BTT != BTT_IsNothrowConvertible) + return true; + + return Self.canThrow(Result.get()) == CT_Cannot; } case BTT_IsAssignable: |