summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-05-21 20:10:50 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-05-21 20:10:50 +0000
commitb2997f579a8b6552a49eab97e33c437b9251eb0a (patch)
tree73c1636810d5a9a7b8d5e9af36cd2c6ab0182eac /clang/test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp
parent6e19543a2a2013bd357eb15e383b435cd0cbb810 (diff)
downloadbcm5719-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/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp')
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp
index 4ae34dec3e3..028fcee5fda 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp
@@ -1,5 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify -Wno-c++1y-extensions
-// RUN: %clang_cc1 -fsyntax-only -std=c++1y %s -verify
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify -Wno-c++1y-extensions -Wno-c++2a-extensions
+// RUN: %clang_cc1 -fsyntax-only -std=c++1y %s -verify -Wno-c++2a-extensions
+// RUN: %clang_cc1 -fsyntax-only -std=c++2a %s -verify
void print();
@@ -60,8 +61,25 @@ template void variadic_lambda(int*, float*, double*);
template<typename ...Args>
void init_capture_pack_err(Args ...args) {
- [as(args)...] {} (); // expected-error {{expected ','}}
- [as...(args)]{} (); // expected-error {{expected ','}}
+ [...as(args)]{} ();
+ [as(args)...] {} (); // expected-error {{ellipsis in pack init-capture must appear before the name of the capture}}
+ [as...(args)]{} (); // expected-error {{ellipsis in pack init-capture must appear before the name of the capture}}
+ [...as{args}]{} ();
+ [as{args}...] {} (); // expected-error {{ellipsis in pack init-capture must appear before the name of the capture}}
+ [as...{args}]{} (); // expected-error {{ellipsis in pack init-capture must appear before the name of the capture}}
+ [...as = args]{} ();
+ [as = args...] {} (); // expected-error {{ellipsis in pack init-capture must appear before the name of the capture}}
+ [as... = args]{} (); // expected-error {{ellipsis in pack init-capture must appear before the name of the capture}}
+
+ [&...as(args)]{} ();
+ [...&as(args)]{} (); // expected-error {{ellipsis in pack init-capture must appear before the name of the capture}}
+
+ [args...] {} ();
+ [...args] {} (); // expected-error {{ellipsis in pack capture must appear after the name of the capture}}
+
+ [&args...] {} ();
+ [...&args] {} (); // expected-error {{ellipsis in pack capture must appear after the name of the capture}}
+ [&...args] {} (); // expected-error {{ellipsis in pack capture must appear after the name of the capture}}
}
template<typename ...Args>
OpenPOWER on IntegriCloud