PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / lambda-init6.C
blobd6c1587487d44fd8a1a4ea19cb703b2df488ea90
1 // Test that captures are not named in the closure type.
2 // { dg-do compile { target c++14 } }
4 int main()
6   int i;
7   auto lam = [i,j=42]{};
8   lam.j;                        // { dg-error "no member" }
9   lam.i;                        // { dg-error "no member" }