1// RUN: clang-pseudo -grammar=cxx -source=%s --print-forest | FileCheck %s
2// We loosely allow capture defaults in any position/multiple times.
3auto lambda = [&, &foo, bar(x), =]{};
4// CHECK: lambda-introducer := [ capture-list ]
5// CHECK-NEXT: ├─[
6// CHECK-NEXT: ├─capture-list
7// CHECK-NEXT: │ ├─capture-list
8// CHECK-NEXT: │ │ ├─capture-list
9// CHECK-NEXT: │ │ │ ├─capture-list~& := tok[4]
10// CHECK-NEXT: │ │ │ ├─,
11// CHECK-NEXT: │ │ │ └─capture~simple-capture
12// CHECK-NEXT: │ │ │ ├─&
13// CHECK-NEXT: │ │ │ └─IDENTIFIER := tok[7]
14// CHECK-NEXT: │ │ ├─,
15// CHECK-NEXT: │ │ └─capture~init-capture
16// CHECK-NEXT: │ │ ├─IDENTIFIER := tok[9]
17// CHECK-NEXT: │ │ └─initializer := ( expression-list )
18// CHECK-NEXT: │ │ ├─(
19// CHECK-NEXT: │ │ ├─expression-list~IDENTIFIER := tok[11]
20// CHECK-NEXT: │ │ └─)
21// CHECK-NEXT: │ ├─,
22// CHECK-NEXT: │ └─capture~=
23// CHECK-NEXT: └─]
24

source code of clang-tools-extra/pseudo/test/cxx/capture-list.cpp