1 // RUN: %clang_cc1 -std=c++2a -verify %s
3 template<typename
...T
, typename
...Lambda
> void check_sizes(Lambda
...L
) {
4 static_assert(((sizeof(T
) == sizeof(Lambda
)) && ...));
7 template<typename
...T
> void f(T
...v
) {
8 // Pack expansion of lambdas: each lambda captures only one pack element.
9 check_sizes
<T
...>([=] { (void)&v
; } ...);
11 // Pack expansion inside lambda: captures all pack elements.
12 auto l
= [=] { ((void)&v
, ...); };
13 static_assert(sizeof(l
) >= (sizeof(T
) + ...));
16 template void f(int, char, double);
19 template <class... Xs
> constexpr int f(Xs
...xs
) {
20 return [&](auto ...ys
) { // expected-note {{instantiation}}
21 return ((xs
+ ys
), ...); // expected-warning {{left operand of comma operator has no effect}}
24 static_assert(f(3, 4) == 6); // expected-note {{instantiation}}