summaryrefslogtreecommitdiffstats
path: root/clang/test
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/test
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/test')
-rw-r--r--clang/test/Analysis/nullptr.cpp12
-rw-r--r--clang/test/CXX/drs/dr21xx.cpp10
-rw-r--r--clang/test/CodeGenCXX/nullptr.cpp41
3 files changed, 10 insertions, 53 deletions
diff --git a/clang/test/Analysis/nullptr.cpp b/clang/test/Analysis/nullptr.cpp
index e9b975c148a..38e099b7fbd 100644
--- a/clang/test/Analysis/nullptr.cpp
+++ b/clang/test/Analysis/nullptr.cpp
@@ -128,10 +128,18 @@ void shouldNotCrash() {
decltype(nullptr) p; // expected-note{{'p' declared without an initial value}}
if (getSymbol()) // expected-note {{Assuming the condition is false}}
// expected-note@-1{{Taking false branch}}
+ // expected-note@-2{{Assuming the condition is false}}
+ // expected-note@-3{{Taking false branch}}
+ // expected-note@-4{{Assuming the condition is true}}
+ // expected-note@-5{{Taking true branch}}
+ invokeF(p); // expected-warning{{1st function call argument is an uninitialized value}}
+ // expected-note@-1{{1st function call argument is an uninitialized value}}
+ if (getSymbol()) // expected-note {{Assuming the condition is false}}
+ // expected-note@-1{{Taking false branch}}
// expected-note@-2{{Assuming the condition is true}}
// expected-note@-3{{Taking true branch}}
- invokeF(p); // expected-note {{Calling 'invokeF'}}
- // expected-note@-1{{Passing null pointer value via 1st parameter 'x'}}
+ invokeF(nullptr); // expected-note {{Calling 'invokeF'}}
+ // expected-note@-1{{Passing null pointer value via 1st parameter 'x'}}
if (getSymbol()) { // expected-note {{Assuming the condition is true}}
// expected-note@-1{{Taking true branch}}
X *xx = Type().x; // expected-note {{Null pointer value stored to field 'x'}}
diff --git a/clang/test/CXX/drs/dr21xx.cpp b/clang/test/CXX/drs/dr21xx.cpp
index b111529b09f..2522ff7dbde 100644
--- a/clang/test/CXX/drs/dr21xx.cpp
+++ b/clang/test/CXX/drs/dr21xx.cpp
@@ -19,16 +19,6 @@ namespace dr2120 { // dr2120: 7
static_assert(!__is_standard_layout(E), "");
}
-namespace dr2140 { // dr2140: 8
-#if __cplusplus >= 201103L
- union U { int a; decltype(nullptr) b; };
- constexpr int *test(U u) {
- return u.b;
- }
- static_assert(!test({123}), "u.b should be valid even when b is inactive");
-#endif
-}
-
namespace dr2180 { // dr2180: yes
class A {
A &operator=(const A &); // expected-note 0-2{{here}}
diff --git a/clang/test/CodeGenCXX/nullptr.cpp b/clang/test/CodeGenCXX/nullptr.cpp
index 222e5e5803c..e93f7061bdd 100644
--- a/clang/test/CodeGenCXX/nullptr.cpp
+++ b/clang/test/CodeGenCXX/nullptr.cpp
@@ -22,44 +22,3 @@ void g() {
const std::type_info& f2() {
return typeid(nullptr_t);
}
-
-union U {
- int n;
- nullptr_t b;
-};
-// CHECK-LABEL: define {{.*}}pr23833_a
-// CHECK: store
-// CHECK: load
-// CHECK-NOT: load
-// CHECK: ret i1 false
-bool pr23833_a(U &u) { return u.b; }
-
-// CHECK-LABEL: define {{.*}}pr23833_b
-// CHECK: store
-// CHECK: load
-// CHECK-NOT: load
-// CHECK: ret i8* null
-nullptr_t pr23833_b(nullptr_t &n) { return n; }
-
-struct X1 { operator int*(); };
-struct X2 { operator const nullptr_t&(); };
-
-// CHECK-LABEL: define {{.*}}pr23833_c
-// CHECK: call {{.*}}X1
-// CHECK: call {{.*}}X2
-// CHECK-NOT: load
-// CHECK: ret i32
-int pr23833_c() {
- return X1() != X2();
-}
-
-// CHECK-LABEL: define {{.*}}pr23833_d
-// CHECK: call {{.*}}X2
-// CHECK-NOT: load
-// CHECK: store
-// CHECK: load
-// CHECK: ret i32*
-int *pr23833_d() {
- int *p = X2();
- return p;
-}
OpenPOWER on IntegriCloud