Initial steps to improve diagnostics when there is a NULL and
a non-pointer on the two sides of a conditional expression.
Patch by Stephen Hines and Mihai Rusu.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125995 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index 8ac0a97..3881765 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -307,3 +307,15 @@
}
}
+
+namespace PR9236 {
+#define NULL 0L
+ void f() {
+ (void)(true ? A() : NULL); // expected-error{{non-pointer operand type 'A' incompatible with NULL}}
+ (void)(true ? NULL : A()); // expected-error{{non-pointer operand type 'A' incompatible with NULL}}
+ (void)(true ? 0 : A()); // expected-error{{incompatible operand types}}
+ (void)(true ? nullptr : A()); // expected-error{{non-pointer operand type 'A' incompatible with nullptr}}
+ (void)(true ? __null : A()); // expected-error{{non-pointer operand type 'A' incompatible with NULL}}
+ (void)(true ? (void*)0 : A()); // expected-error{{incompatible operand types}}
+ }
+}