diff options
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 959cdadad87..5aedbe7644e 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -81,8 +81,16 @@ ExprResult Sema::ActOnNoexceptSpec(SourceLocation NoexceptLoc, ExceptionSpecificationType &EST) { // FIXME: This is bogus, a noexcept expression is not a condition. ExprResult Converted = CheckBooleanCondition(NoexceptLoc, NoexceptExpr); - if (Converted.isInvalid()) - return Converted; + if (Converted.isInvalid()) { + EST = EST_NoexceptFalse; + + // Fill in an expression of 'false' as a fixup. + auto *BoolExpr = new (Context) + CXXBoolLiteralExpr(false, Context.BoolTy, NoexceptExpr->getBeginLoc()); + llvm::APSInt Value{1}; + Value = 0; + return ConstantExpr::Create(Context, BoolExpr, APValue{Value}); + } if (Converted.get()->isValueDependent()) { EST = EST_DependentNoexcept; |