From a8bea4b90ec7448231306920b7a55ab4a13841cc Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 18 Feb 2011 23:54:50 +0000 Subject: 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. llvm-svn: 125995 --- clang/test/SemaCXX/conditional-expr.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/test/SemaCXX/conditional-expr.cpp') diff --git a/clang/test/SemaCXX/conditional-expr.cpp b/clang/test/SemaCXX/conditional-expr.cpp index 8ac0a9736ac..3881765cff3 100644 --- a/clang/test/SemaCXX/conditional-expr.cpp +++ b/clang/test/SemaCXX/conditional-expr.cpp @@ -307,3 +307,15 @@ namespace PR7598 { } } + +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}} + } +} -- cgit v1.2.3