diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-29 01:16:42 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-29 01:16:42 +0000 |
commit | 9988f28fe7a6c19239a7426fea1ab23f9a8aac9c (patch) | |
tree | 32bd3325d1d69326b1e893d571b931c47da7d2ed /test/FixIt/fixit-cxx0x.cpp | |
parent | 0fd4a6869e9a12999af24b8df7a0275a0e6c18be (diff) |
Reject 'template<typename...Ts> void f(Ts ...(x));'. Add a special-case
diagnostic and a fix-it to explain to the user where the ellipsis is
supposed to go.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FixIt/fixit-cxx0x.cpp')
-rw-r--r-- | test/FixIt/fixit-cxx0x.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp index dcd9f74a10..dfc5c8c561 100644 --- a/test/FixIt/fixit-cxx0x.cpp +++ b/test/FixIt/fixit-cxx0x.cpp @@ -77,3 +77,26 @@ void f() { 'c'_z; 'd'_whoops; } + +template<typename ...Ts> struct MisplacedEllipsis { + int a(Ts ...(x)); // expected-error {{'...' must immediately precede declared identifier}} + int b(Ts ...&x); // expected-error {{'...' must immediately precede declared identifier}} + int c(Ts ...&); // expected-error {{'...' must be innermost component of anonymous pack declaration}} + int d(Ts ...(...&...)); // expected-error 2{{'...' must be innermost component of anonymous pack declaration}} + int e(Ts ...*[]); // expected-error {{'...' must be innermost component of anonymous pack declaration}} + int f(Ts ...(...*)()); // expected-error 2{{'...' must be innermost component of anonymous pack declaration}} + int g(Ts ...()); // ok +}; +namespace TestMisplacedEllipsisRecovery { + MisplacedEllipsis<int, char> me; + int i; char k; + int *ip; char *kp; + int ifn(); char kfn(); + int a = me.a(i, k); + int b = me.b(i, k); + int c = me.c(i, k); + int d = me.d(i, k); + int e = me.e(&ip, &kp); + int f = me.f(ifn, kfn); + int g = me.g(ifn, kfn); +} |