Chris Lattner | ab9d51c | 2009-04-19 20:10:12 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -Eonly -verify -pedantic %s |
Chris Lattner | 01ecf83 | 2006-07-19 05:42:48 +0000 | [diff] [blame] | 2 | // pasting ""x"" and ""+"" does not give a valid preprocessing token |
Chris Lattner | 1377dc4 | 2009-04-19 18:54:13 +0000 | [diff] [blame] | 3 | #define XYZ x ## + // expected-error {{pasting formed 'x', an invalid preprocessing token}} |
Chris Lattner | 01ecf83 | 2006-07-19 05:42:48 +0000 | [diff] [blame] | 4 | XYZ |
| 5 | |
Chris Lattner | ab9d51c | 2009-04-19 20:10:12 +0000 | [diff] [blame^] | 6 | // GCC PR 20077 |
| 7 | // RUN: clang-cc -Eonly %s -verify |
| 8 | |
| 9 | #define a a ## ## // expected-error {{'##' cannot appear at end of macro expansion}} |
| 10 | #define b() b ## ## // expected-error {{'##' cannot appear at end of macro expansion}} |
| 11 | #define c c ## // expected-error {{'##' cannot appear at end of macro expansion}} |
| 12 | #define d() d ## // expected-error {{'##' cannot appear at end of macro expansion}} |
| 13 | |
| 14 | |
| 15 | #define e ## ## e // expected-error {{'##' cannot appear at start of macro expansion}} |
| 16 | #define f() ## ## f // expected-error {{'##' cannot appear at start of macro expansion}} |
| 17 | #define g ## g // expected-error {{'##' cannot appear at start of macro expansion}} |
| 18 | #define h() ## h // expected-error {{'##' cannot appear at start of macro expansion}} |
| 19 | #define i ## // expected-error {{'##' cannot appear at start of macro expansion}} |
| 20 | #define j() ## // expected-error {{'##' cannot appear at start of macro expansion}} |
| 21 | |
| 22 | |