r301891 - Revert r301785 (and r301787) because they caused PR32864.
Nick Lewycky via cfe-commits
cfe-commits at lists.llvm.org
Mon May 1 18:06:16 PDT 2017
Author: nicholas
Date: Mon May 1 20:06:16 2017
New Revision: 301891
URL: http://llvm.org/viewvc/llvm-project?rev=301891&view=rev
Log:
Revert r301785 (and r301787) because they caused PR32864.
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.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/Sema/integer-overflow.c
cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=301891&r1=301890&r2=301891&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Mon May 1 20:06:16 2017
@@ -2186,9 +2186,6 @@ static bool HandleLValueBase(EvalInfo &I
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;
@@ -9946,11 +9943,8 @@ static bool EvaluateAsRValue(EvalInfo &I
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;
Modified: cfe/trunk/test/Sema/integer-overflow.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/integer-overflow.c?rev=301891&r1=301890&r2=301891&view=diff
==============================================================================
--- cfe/trunk/test/Sema/integer-overflow.c (original)
+++ cfe/trunk/test/Sema/integer-overflow.c Mon May 1 20:06:16 2017
@@ -149,16 +149,16 @@ uint64_t check_integer_overflows(int i)
// expected-warning at +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 at +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 at +1 {{overflow in expression; result is 536870912 with type 'int'}}
- (void)(-(4608 * 1024 * 1024));
+ int j2 = -(4608 * 1024 * 1024);
// expected-warning at +1 {{overflow in expression; result is 536870912 with type 'int'}}
- (void)b[4608 * 1024 * 1024];
+ uint64_t j3 = b[4608 * 1024 * 1024];
// expected-warning at +1 2{{overflow in expression; result is 536870912 with type 'int'}}
return ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024)));
Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp?rev=301891&r1=301890&r2=301891&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp (original)
+++ cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp Mon May 1 20:06:16 2017
@@ -60,10 +60,6 @@ namespace DerivedToVBaseCast {
static_assert((U*)&d == w, "");
static_assert((U*)&d == x, "");
- // expected-error at +2 {{constexpr variable 'a' must be initialized by a constant expression}}
- // expected-warning at +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 {};
More information about the cfe-commits
mailing list