1 // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s -std=c11
2 
test1(int * a)3 int test1(int *a) {
4   return a == '\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
5 }
6 
test2(int * a)7 int test2(int *a) {
8   return '\0' == a; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
9 }
10 
test3(int * a)11 int test3(int *a) {
12   return a == L'\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
13 }
14 
test4(int * a)15 int test4(int *a) {
16   return a == u'\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
17 }
18 
test5(int * a)19 int test5(int *a) {
20   return a == U'\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
21 }
22 
test6(int * a)23 int test6(int *a) {
24   return a == (char)0; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
25 }
26 
27 typedef char my_char;
test7(int * a)28 int test7(int *a) {
29   return a == (my_char)0;
30   // expected-warning@-1 {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
31 }
32 
test8(int * a)33 int test8(int *a) {
34   return a != '\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to (void *)0?}}
35 }
36 
37 #define NULL (void *)0
test9(int * a)38 int test9(int *a) {
39   return a == '\0'; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to NULL?}}
40 }
41 
42 #define MYCHAR char
test10(int * a)43 int test10(int *a) {
44   return a == (MYCHAR)0; // expected-warning {{comparing a pointer to a null character constant; did you mean to compare to NULL?}}
45 }
46 
test11(int * a)47 int test11(int *a) {
48   return a > '\0';
49 }
50