diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-02-18 23:54:50 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-02-18 23:54:50 +0000 |
commit | a8bea4b90ec7448231306920b7a55ab4a13841cc (patch) | |
tree | 38d943d1ad2cd6ca939aae044d4dc01ad74544a5 /clang/test/SemaCXX/conditional-expr.cpp | |
parent | 55532be31fbc60797efe9a181b01f0a4f8058fa0 (diff) | |
download | bcm5719-llvm-a8bea4b90ec7448231306920b7a55ab4a13841cc.tar.gz bcm5719-llvm-a8bea4b90ec7448231306920b7a55ab4a13841cc.zip |
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
Diffstat (limited to 'clang/test/SemaCXX/conditional-expr.cpp')
-rw-r--r-- | clang/test/SemaCXX/conditional-expr.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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}} + } +} |