diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/Preprocessor/macro_vaopt_check.cpp | |
parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) |
Diffstat (limited to 'test/Preprocessor/macro_vaopt_check.cpp')
-rw-r--r-- | test/Preprocessor/macro_vaopt_check.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/test/Preprocessor/macro_vaopt_check.cpp b/test/Preprocessor/macro_vaopt_check.cpp new file mode 100644 index 0000000000000..25a4564fba7ed --- /dev/null +++ b/test/Preprocessor/macro_vaopt_check.cpp @@ -0,0 +1,64 @@ +// RUN: %clang_cc1 %s -Eonly -verify -Wno-all -pedantic -std=c++2a + +//expected-error@+1{{missing '('}} +#define V1(...) __VA_OPT__ +#undef V1 +// OK +#define V1(...) __VA_OPT__ () +#undef V1 + +//expected-warning@+1{{can only appear in the expansion of a variadic macro}} +#define V2() __VA_OPT__(x) +#undef V2 + +//expected-error@+2{{missing ')' after}} +//expected-note@+1{{to match this '('}} +#define V3(...) __VA_OPT__( +#undef V3 + +#define V4(...) __VA_OPT__(__VA_ARGS__) +#undef V4 + +//expected-error@+1{{nested}} +#define V5(...) __VA_OPT__(__VA_OPT__()) +#undef V5 + +//expected-error@+1{{not followed by}} +#define V1(...) __VA_OPT__ (#) +#undef V1 + +//expected-error@+1{{cannot appear at start}} +#define V1(...) __VA_OPT__ (##) +#undef V1 + +//expected-error@+1{{cannot appear at start}} +#define V1(...) __VA_OPT__ (## X) x +#undef V1 + +//expected-error@+1{{cannot appear at end}} +#define V1(...) y __VA_OPT__ (X ##) +#undef V1 + + +#define FOO(x,...) # __VA_OPT__(x) #x #__VA_OPT__(__VA_ARGS__) //OK + +//expected-error@+1{{not followed by a macro parameter}} +#define V1(...) __VA_OPT__(#) +#undef V1 + +//expected-error@+1{{cannot appear at start}} +#define V1(...) a __VA_OPT__(##) b +#undef V1 + +//expected-error@+1{{cannot appear at start}} +#define V1(...) a __VA_OPT__(a ## b) b __VA_OPT__(##) +#undef V1 + +#define V1(x,...) # __VA_OPT__(b x) // OK +#undef V1 + +//expected-error@+2{{missing ')' after}} +//expected-note@+1{{to match this '('}} +#define V1(...) __VA_OPT__ ((()) +#undef V1 + |