Richard Smith | eb3ce7c | 2011-12-16 22:50:01 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -fsyntax-only -verify |
| 2 | |
Richard Smith | 5edd583 | 2012-08-30 13:38:46 +0000 | [diff] [blame] | 3 | #define a(x) enum { x } |
| 4 | a(n = |
| 5 | #undef a |
| 6 | #define a 5 |
| 7 | a); |
| 8 | _Static_assert(n == 5, ""); |
| 9 | |
David Majnemer | f2d3bc0 | 2014-12-28 07:42:49 +0000 | [diff] [blame] | 10 | #define M(A) |
| 11 | M( |
| 12 | #pragma pack(pop) // expected-error {{embedding a #pragma directive within macro arguments is not supported}} |
| 13 | ) |
| 14 | |
Richard Smith | eb3ce7c | 2011-12-16 22:50:01 +0000 | [diff] [blame] | 15 | // header1.h |
| 16 | void fail(const char *); |
| 17 | #define MUNCH(...) \ |
| 18 | ({ int result = 0; __VA_ARGS__; if (!result) { fail(#__VA_ARGS__); }; result }) |
| 19 | |
| 20 | static inline int f(int k) { |
| 21 | return MUNCH( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{returning 'void'}} |
| 22 | if (k < 3) |
| 23 | result = 24; |
| 24 | else if (k > 4) |
| 25 | result = k - 4; |
| 26 | } |
| 27 | |
| 28 | #include "macro_arg_directive.h" // expected-error {{embedding a #include directive within macro arguments is not supported}} |
| 29 | |
| 30 | int g(int k) { |
| 31 | return f(k) + f(k-1)); |
| 32 | } |