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

extern int b[];

void
foo (int n)
{
  int a[n];
  a[0] = 42;
  auto [x] = a;					// { dg-warning "structured bindings only available with" "" { target c++14_down } }
						// { dg-error "cannot decompose variable length array 'int \\\[n\\\]'" "" { target *-*-* } .-1 }
  auto [y] = b;					// { dg-warning "structured bindings only available with" "" { target c++14_down } }
						// { dg-error "deduced type 'int \\\[\\\]' for '<structured bindings>' is incomplete" "" { target *-*-* } .-1 }
}