diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-21 20:10:50 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-21 20:10:50 +0000 |
commit | b2997f579a8b6552a49eab97e33c437b9251eb0a (patch) | |
tree | 73c1636810d5a9a7b8d5e9af36cd2c6ab0182eac /clang/test/FixIt/fixit-c++2a.cpp | |
parent | 6e19543a2a2013bd357eb15e383b435cd0cbb810 (diff) | |
download | bcm5719-llvm-b2997f579a8b6552a49eab97e33c437b9251eb0a.tar.gz bcm5719-llvm-b2997f579a8b6552a49eab97e33c437b9251eb0a.zip |
[c++20] P0780R2: Support pack-expansion of init-captures.
This permits an init-capture to introduce a new pack:
template<typename ...T> auto x = [...a = T()] { /* a is a pack */ };
To support this, the mechanism for allowing ParmVarDecls to be packs has
been extended to support arbitrary local VarDecls.
llvm-svn: 361300
Diffstat (limited to 'clang/test/FixIt/fixit-c++2a.cpp')
-rw-r--r-- | clang/test/FixIt/fixit-c++2a.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/FixIt/fixit-c++2a.cpp b/clang/test/FixIt/fixit-c++2a.cpp new file mode 100644 index 00000000000..c97bb7ae610 --- /dev/null +++ b/clang/test/FixIt/fixit-c++2a.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -verify -std=c++2a %s +// RUN: cp %s %t +// RUN: not %clang_cc1 -x c++ -std=c++2a -fixit %t +// RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++2a %t + +/* This is a test of the various code modification hints that only + apply in C++2a. */ +template<typename ...T> void init_capture_pack(T ...a) { + [x... = a]{}; // expected-error {{must appear before the name}} + [x = a...]{}; // expected-error {{must appear before the name}} + [...&x = a]{}; // expected-error {{must appear before the name}} + [...a]{}; // expected-error {{must appear after the name}} + [&...a]{}; // expected-error {{must appear after the name}} + [...&a]{}; // expected-error {{must appear after the name}} +} |