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
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 4ae5ab4..5420876 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -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);
     }
 
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c
index 22ac67a..a9c8806 100644
--- a/test/Sema/const-eval.c
+++ b/test/Sema/const-eval.c
@@ -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}}