1 // RUN: %clang_cc1 -x c -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -x c++ -fsyntax-only -verify %s
3
4 #define DELIM "/"
5 #define DOT "."
6 #define NULL (void *)0
7
test(const char * d)8 void test(const char *d) {
9 if ("/" != d) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
10 return;
11 if (d == "/") // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
12 return;
13 if ("/" != NULL)
14 return;
15 if (NULL == "/")
16 return;
17 if ("/" != DELIM) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
18 return;
19 if (DELIM == "/") // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
20 return;
21 if (DELIM != NULL)
22 return;
23 if (NULL == DELIM)
24 return;
25 if (DOT != DELIM) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
26 return;
27 if (DELIM == DOT) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
28 return;
29 }
30