aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/decomp63.C
blob: 50049255efb16c008aa3358dfcef7f9ea007997a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// PR c++/118719
// { dg-do compile { target c++11 } }
// { dg-options "" }

int
main ()
{
  int a[] = { 42 };
  auto [x] = a;					// { dg-warning "structured bindings only available with" "" { target c++14_down } }
						// { dg-message "declared here" "" { target c++17_down } .-1 }
  [=] () { int b = x; (void) b; };		// { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } }
  [&] () { int b = x; (void) b; };		// { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } }
  [x] () { int b = x; (void) b; };		// { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } }
  [&x] () { int b = x; (void) b; };		// { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } }
  [x = x] () { int b = x; (void) b; };		// { dg-warning "lambda capture initializers only available with" "" { target c++11_only } }
  [y = x] () { int b = y; (void) b; };		// { dg-warning "lambda capture initializers only available with" "" { target c++11_only } }
  [y = x * 2] () { int b = y; (void) b; };	// { dg-warning "lambda capture initializers only available with" "" { target c++11_only } }
}