The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers one testcase failure because the AST for "constexpr _Complex float test2 = {1};" is wrong (the _Complex prvalue should not be const-qualified), and a number of test failures in test/OpenMP where the captured stmt contains an InitListExpr that is in syntactic form.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301891
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!Base->isVirtual())
return HandleLValueDirectBase(Info, E, Obj, DerivedDecl, BaseDecl);
- if (!Obj.checkNullPointer(Info, E, CSK_Base))
- return false;
-
SubobjectDesignator &D = Obj.Designator;
if (D.Invalid)
return false;
if (E->getType().isNull())
return false;
- if (!CheckLiteralType(Info, E)) {
- if (Info.noteFailure())
- EvaluateIgnoredValue(Info, E);
+ if (!CheckLiteralType(Info, E))
return false;
- }
if (!::Evaluate(Result, Info, E))
return false;
// expected-warning@+2 {{overflow in expression; result is 536870912 with type 'int'}}
uint64_t *b;
- (void)b[4608 * 1024 * 1024];
+ uint64_t b2 = b[4608 * 1024 * 1024] + 1;
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
- (void)(i ? (4608 * 1024 * 1024) : (4608 * 1024 * 1024));
+ int j1 = i ? (4608 * 1024 * 1024) : (4608 * 1024 * 1024);
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
- (void)(-(4608 * 1024 * 1024));
+ int j2 = -(4608 * 1024 * 1024);
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
- (void)b[4608 * 1024 * 1024];
+ uint64_t j3 = b[4608 * 1024 * 1024];
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
return ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024)));
static_assert((U*)&d == w, "");
static_assert((U*)&d == x, "");
- // expected-error@+2 {{constexpr variable 'a' must be initialized by a constant expression}}
- // expected-warning@+1 {{binding dereferenced null pointer to reference has undefined behavior}}
- constexpr A &a = *((B*)0); // expected-note {{cannot access base class of null pointer}}
-
struct X {};
struct Y1 : virtual X {};
struct Y2 : X {};