diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-06-08 17:35:15 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-06-08 17:35:15 +0000 |
| commit | 4038cf4b57da3574a32008aae6357eacdcc3f89e (patch) | |
| tree | 971b6b6742f309b743240ff819f3064e3ecc9b8d /clang/test/SemaCXX/warn_false_to_pointer.cpp | |
| parent | 5729f51410e37f5d940f57f5c77d29b8f222e47d (diff) | |
| download | bcm5719-llvm-4038cf4b57da3574a32008aae6357eacdcc3f89e.tar.gz bcm5719-llvm-4038cf4b57da3574a32008aae6357eacdcc3f89e.zip | |
Implement a warning when converting the literal 'false' to a
pointer. Original patch by Troy D. Straszheim; fixes PR7283.
llvm-svn: 105621
Diffstat (limited to 'clang/test/SemaCXX/warn_false_to_pointer.cpp')
| -rw-r--r-- | clang/test/SemaCXX/warn_false_to_pointer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn_false_to_pointer.cpp b/clang/test/SemaCXX/warn_false_to_pointer.cpp new file mode 100644 index 00000000000..3a873d886f0 --- /dev/null +++ b/clang/test/SemaCXX/warn_false_to_pointer.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +int* j = false; // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}} + +void foo(int* i, int *j=(false)) // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}} +{ + foo(false); // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}} +} + |

