forked from OSchip/llvm-project
Fix a crash in the diangostic code in EvalConstant. PR12043.
llvm-svn: 151100
This commit is contained in:
parent
d6e765c69f
commit
ebea9aff0d
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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}}
|
||||
|
|
Loading…
Reference in New Issue