diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-02-21 22:41:33 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-02-21 22:41:33 +0000 |
commit | 51e47df5a57430f1b691b04258e663cce68aef9d (patch) | |
tree | 9a406576e50e18aff9b96303e5960c9ca6e53112 | |
parent | 2789d8e753a9bdd36f2f90ba03ba4fb7521bcbb1 (diff) |
Fix a crash in the diangostic code in EvalConstant. PR12043.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151100 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ExprConstant.cpp | 4 | ||||
-rw-r--r-- | test/Sema/const-eval.c | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 4ae5ab42ff..5420876866 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -538,8 +538,10 @@ namespace { = 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); } diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c index 22ac67adad..a9c8806b5d 100644 --- a/test/Sema/const-eval.c +++ b/test/Sema/const-eval.c @@ -112,3 +112,8 @@ int castViaInt[*(int*)(unsigned long)"test"]; // expected-error {{variable lengt // 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}} |