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

template <typename T>
struct S
{
  enum E { A };
  void f () { auto [x] = 0; x++; }	// { dg-error "cannot decompose non-array non-class type" }
					// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
  void g (T t) { auto [y] = t; y++; }	// { dg-error "cannot decompose non-array non-class type" }
};					// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }

int
main ()
{
  S <int> s;
  s.f ();
  s.g (5);
}