[cfe-commits] r151100 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/Sema/const-eval.c
Eli Friedman
eli.friedman at gmail.com
Tue Feb 21 14:41:33 PST 2012
Author: efriedma
Date: Tue Feb 21 16:41:33 2012
New Revision: 151100
URL: http://llvm.org/viewvc/llvm-project?rev=151100&view=rev
Log:
Fix a crash in the diangostic code in EvalConstant. PR12043.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/Sema/const-eval.c
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=151100&r1=151099&r2=151100&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Feb 21 16:41:33 2012
@@ -538,8 +538,10 @@
= diag::note_invalid_subexpr_in_const_expr,
unsigned ExtraNotes = 0) {
// Don't override a previous diagnostic.
- if (!EvalStatus.Diag || !EvalStatus.Diag->empty())
+ if (!EvalStatus.Diag || !EvalStatus.Diag->empty()) {
+ HasActiveDiagnostic = false;
return OptionalDiagnostic();
+ }
return Diag(Loc, DiagId, ExtraNotes);
}
Modified: cfe/trunk/test/Sema/const-eval.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/const-eval.c?rev=151100&r1=151099&r2=151100&view=diff
==============================================================================
--- cfe/trunk/test/Sema/const-eval.c (original)
+++ cfe/trunk/test/Sema/const-eval.c Tue Feb 21 16:41:33 2012
@@ -112,3 +112,8 @@
// PR11391.
struct PR11391 { _Complex float f; } pr11391;
EVAL_EXPR(42, __builtin_constant_p(pr11391.f = 1))
+
+// PR12043
+float varfloat;
+const float constfloat = 0;
+EVAL_EXPR(43, varfloat && constfloat) // expected-error {{must have a constant size}}
More information about the cfe-commits
mailing list