1// RUN: %clang_cc1 -Eonly -verify -pedantic %s 2// pasting ""x"" and ""+"" does not give a valid preprocessing token 3#define XYZ x ## + 4XYZ // expected-error {{pasting formed 'x+', an invalid preprocessing token}} 5#define XXYZ . ## test 6XXYZ // expected-error {{pasting formed '.test', an invalid preprocessing token}} 7 8// GCC PR 20077 9 10#define a a ## ## // expected-error {{'##' cannot appear at end of macro expansion}} 11#define b() b ## ## // expected-error {{'##' cannot appear at end of macro expansion}} 12#define c c ## // expected-error {{'##' cannot appear at end of macro expansion}} 13#define d() d ## // expected-error {{'##' cannot appear at end of macro expansion}} 14 15 16#define e ## ## e // expected-error {{'##' cannot appear at start of macro expansion}} 17#define f() ## ## f // expected-error {{'##' cannot appear at start of macro expansion}} 18#define g ## g // expected-error {{'##' cannot appear at start of macro expansion}} 19#define h() ## h // expected-error {{'##' cannot appear at start of macro expansion}} 20#define i ## // expected-error {{'##' cannot appear at start of macro expansion}} 21#define j() ## // expected-error {{'##' cannot appear at start of macro expansion}} 22 23// Invalid token pasting. 24// PR3918 25 26// When pasting creates poisoned identifiers, we error. 27#pragma GCC poison BLARG 28BLARG // expected-error {{attempt to use a poisoned identifier}} 29#define XX BL ## ARG 30XX // expected-error {{attempt to use a poisoned identifier}} 31 32#define VA __VA_ ## ARGS__ 33int VA; // expected-warning {{__VA_ARGS__ can only appear in the expansion of a C99 variadic macro}} 34 35