diff options
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index fb0307fb28..2176afa92d 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -9636,18 +9636,15 @@ Decl *Sema::ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, StringLiteral *AssertMessage = cast<StringLiteral>(AssertMessageExpr_); if (!AssertExpr->isTypeDependent() && !AssertExpr->isValueDependent()) { - llvm::APSInt Value(32); - if (!AssertExpr->isIntegerConstantExpr(Value, Context)) { - Diag(StaticAssertLoc, - diag::err_static_assert_expression_is_not_constant) << - AssertExpr->getSourceRange(); + llvm::APSInt Cond; + if (VerifyIntegerConstantExpression(AssertExpr, &Cond, + diag::err_static_assert_expression_is_not_constant, + /*AllowFold=*/false)) return 0; - } - if (Value == 0) { + if (!Cond) Diag(StaticAssertLoc, diag::err_static_assert_failed) << AssertMessage->getString() << AssertExpr->getSourceRange(); - } } if (DiagnoseUnexpandedParameterPack(AssertExpr, UPPC_StaticAssertExpression)) |