1 // RUN: not %clang -cc1 -fsyntax-only %s 2>&1 | FileCheck %s
2
3 #define a b
4 #define b c
5 #define c(x) d(x)
6 #define d(x) x*1
7
8 #define e f
9 #define f g
10 #define g(x) h(x)
11 #define h(x) x
12
PR16799()13 void PR16799() {
14 const char str[] = "string";
15 a(str);
16 // CHECK: :15:3: error: invalid operands to binary expression
17 // CHECK: ('const char *' and 'int')
18 // CHECK: a(str);
19 // CHECK: ^~~~~~
20 // CHECK: :3:11: note: expanded from macro 'a'
21 // CHECK: #define a b
22 // CHECK: ^
23 // CHECK: :4:11: note: expanded from macro 'b'
24 // CHECK: #define b c
25 // CHECK: ^
26 // CHECK: :5:14: note: expanded from macro 'c'
27 // CHECK: #define c(x) d(x)
28 // CHECK: ^~~~
29 // CHECK: :6:15: note: expanded from macro 'd'
30 // CHECK: #define d(x) x*1
31 // CHECK: ~^~
32
33 e(str);
34 // CHECK: :33:5: warning: expression result unused
35 // CHECK: e(str);
36 // CHECK: ^~~
37 // CHECK: :8:11: note: expanded from macro 'e'
38 // CHECK: #define e f
39 // CHECK: ^
40 // CHECK: :9:11: note: expanded from macro 'f'
41 // CHECK: #define f g
42 // CHECK: ^
43 // CHECK: :10:16: note: expanded from macro 'g'
44 // CHECK: #define g(x) h(x)
45 // CHECK: ^
46 // CHECK: :11:14: note: expanded from macro 'h'
47 // CHECK: #define h(x) x
48 // CHECK: ^
49 }
50 // CHECK: 1 warning and 1 error generated.
51