summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn_false_to_pointer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/warn_false_to_pointer.cpp')
-rw-r--r--clang/test/SemaCXX/warn_false_to_pointer.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/warn_false_to_pointer.cpp b/clang/test/SemaCXX/warn_false_to_pointer.cpp
index 26b54f6e685..20d4b3a52d4 100644
--- a/clang/test/SemaCXX/warn_false_to_pointer.cpp
+++ b/clang/test/SemaCXX/warn_false_to_pointer.cpp
@@ -5,7 +5,14 @@ int* j = false; // expected-warning{{ initialization of pointer of type 'int *'
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'}}
- foo((int*)false);
+ foo((int*)false); // no-warning: explicit cast
+ foo(0); // no-warning: not a bool, even though its convertible to bool
+
+ foo(false == true); // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}
+ foo((42 + 24) < 32); // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}
+
+ const bool kFlag = false;
+ foo(kFlag); // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}
}
char f(struct Undefined*);
OpenPOWER on IntegriCloud