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 | 0efa75c3e38d77364c0a3758469bd02feca9756b (patch) | |
tree | e05420a89258766896a0a9f6c1001a265c35e998 /clang/test/FixIt/fixit-cxx0x.cpp | |
parent | 28e0a7f6c11f4e7b405c6f4a8835065c04cf4087 (diff) | |
download | bcm5719-llvm-0efa75c3e38d77364c0a3758469bd02feca9756b.tar.gz bcm5719-llvm-0efa75c3e38d77364c0a3758469bd02feca9756b.zip |
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.
llvm-svn: 153622
Diffstat (limited to 'clang/test/FixIt/fixit-cxx0x.cpp')
-rw-r--r-- | clang/test/FixIt/fixit-cxx0x.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/FixIt/fixit-cxx0x.cpp b/clang/test/FixIt/fixit-cxx0x.cpp index dcd9f74a108..dfc5c8c5610 100644 --- a/clang/test/FixIt/fixit-cxx0x.cpp +++ b/clang/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); +} |