summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-11-03 02:23:33 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-11-03 02:23:33 +0000
commit35018958637384423c1f8a48628c8f3f8dea23c5 (patch)
treed7bb426a5653b3e26093680054b15c90442da7b8 /clang/lib/Sema
parentc39b97f2112e015cd463ddc434945ba04dba687d (diff)
downloadbcm5719-llvm-35018958637384423c1f8a48628c8f3f8dea23c5.tar.gz
bcm5719-llvm-35018958637384423c1f8a48628c8f3f8dea23c5.zip
Revert r345562: "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type"
This exposes a (known) CodeGen bug: it can't cope with emitting lvalue expressions that denote non-odr-used but usable-in-constant-expression variables. See PR39528 for a testcase. Reverted for now until that issue can be fixed. llvm-svn: 346065
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp7
-rw-r--r--clang/lib/Sema/SemaInit.cpp10
2 files changed, 5 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index d7fc1aa04dd..a7dc08248eb 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -623,11 +623,8 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
if (E->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
Cleanup.setExprNeedsCleanups(true);
- // C++ [conv.lval]p3:
- // If T is cv std::nullptr_t, the result is a null pointer constant.
- CastKind CK = T->isNullPtrType() ? CK_NullToPointer : CK_LValueToRValue;
- ExprResult Res =
- ImplicitCastExpr::Create(Context, T, CK, E, nullptr, VK_RValue);
+ ExprResult Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E,
+ nullptr, VK_RValue);
// C11 6.3.2.1p2:
// ... if the lvalue has atomic type, the value has the non-atomic version
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 0cfac997199..1e4d12d20cd 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -7644,13 +7644,9 @@ InitializationSequence::Perform(Sema &S,
case SK_LValueToRValue: {
assert(CurInit.get()->isGLValue() && "cannot load from a prvalue");
- // C++ [conv.lval]p3:
- // If T is cv std::nullptr_t, the result is a null pointer constant.
- CastKind CK =
- Step->Type->isNullPtrType() ? CK_NullToPointer : CK_LValueToRValue;
- CurInit =
- ImplicitCastExpr::Create(S.Context, Step->Type, CK, CurInit.get(),
- /*BasePath=*/nullptr, VK_RValue);
+ CurInit = ImplicitCastExpr::Create(S.Context, Step->Type,
+ CK_LValueToRValue, CurInit.get(),
+ /*BasePath=*/nullptr, VK_RValue);
break;
}
OpenPOWER on IntegriCloud