Catch a few more cases of illegal comparisons.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79793 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 6b64bac..395a1a9 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -24,13 +24,15 @@
return a > (void *)0; // expected-warning {{comparison of distinct pointer types}}
}
-int function_pointers(int (*a)(int), int (*b)(int)) {
+int function_pointers(int (*a)(int), int (*b)(int), void (*c)(int)) {
return a > b; // expected-warning {{ordered comparison of function pointers}}
return function_pointers > function_pointers; // expected-warning {{ordered comparison of function pointers}}
+ return a > c; // expected-warning {{comparison of distinct pointer types}}
return a == (void *) 0;
- return a == (void *) 1; // expected-warning {{comparison of distinct pointer types}}
+ return a == (void *) 1; // expected-warning {{equality comparison between function pointer and void pointer}}
}
-int void_pointers(void *foo) {
- return foo == NULL;
+int void_pointers(void* foo) {
+ return foo == (void*) 0;
+ return foo == (void*) 1;
}