summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/ExprConstant.cpp8
-rw-r--r--clang/test/Sema/integer-overflow.c8
-rw-r--r--clang/test/SemaCXX/constant-expression-cxx11.cpp4
3 files changed, 5 insertions, 15 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5e6a629c01b..4d0805323e5 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -2186,9 +2186,6 @@ static bool HandleLValueBase(EvalInfo &Info, const Expr *E, LValue &Obj,
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 &Info, const Expr *E, APValue &Result) {
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;
diff --git a/clang/test/Sema/integer-overflow.c b/clang/test/Sema/integer-overflow.c
index b2b7903e516..62ee33e3d18 100644
--- a/clang/test/Sema/integer-overflow.c
+++ b/clang/test/Sema/integer-overflow.c
@@ -149,16 +149,16 @@ uint64_t check_integer_overflows(int i) {
// 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)));
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp
index 2a5e80adf89..4abbc8e9284 100644
--- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
@@ -60,10 +60,6 @@ namespace DerivedToVBaseCast {
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 {};
OpenPOWER on IntegriCloud