Perform lvalue-to-rvalue conversions on both operands of ->*
and the RHS of .*. Noticed by Enea Zaffanella!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134170 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/member-pointer.cpp b/test/SemaCXX/member-pointer.cpp
index de3b211..cf64810 100644
--- a/test/SemaCXX/member-pointer.cpp
+++ b/test/SemaCXX/member-pointer.cpp
@@ -296,3 +296,19 @@
mem_fn(&test::nullary_v)(t); // expected-note{{in instantiation of}}
}
}
+
+namespace test8 {
+ struct A { int foo; };
+ int test1() {
+ // Verify that we perform (and check) an lvalue conversion on the operands here.
+ return (*((A**) 0)) // expected-warning {{indirection of non-volatile null pointer will be deleted}} expected-note {{consider}}
+ ->**(int A::**) 0; // expected-warning {{indirection of non-volatile null pointer will be deleted}} expected-note {{consider}}
+ }
+
+ int test2() {
+ // Verify that we perform (and check) an lvalue conversion on the operands here.
+ // TODO: the .* should itself warn about being a dereference of null.
+ return (*((A*) 0))
+ .**(int A::**) 0; // expected-warning {{indirection of non-volatile null pointer will be deleted}} expected-note {{consider}}
+ }
+}