diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-14 23:32:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-14 23:32:26 +0000 |
commit | daaefc5381f9aafbb1cb6f88fb5ac6aaf34d65bf (patch) | |
tree | 8f5c84efdcc439b671448e168c779522ab53e81b /lib/Sema/SemaDeclCXX.cpp | |
parent | 0a36512b175103d60020aaa857363dca33f36558 (diff) |
Produce more detailed diagnostics when static_assert condition is not an ICE.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146607 91177308-0d34-0410-b5e6-96231b3b80d8
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)) |