aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/decomp56.C
blob: 25a4c3def6b0131d511a9c9d1e90394169351cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// PR c++/84469
// { dg-do compile { target c++11 } }
// { dg-options "" }

struct A {
  template <typename T>
  void bar () const {}
  template <typename T>
  void baz () const {}
};
struct B { A a; };

template <typename>
void
foo ()
{
  A a[1][1];
  for (auto const& [b]: a)	// { dg-warning "structured bindings only available with" "" { target c++14_down } }
    b.bar<int> ();
  B c;
  auto const& [d] = c;		// { dg-warning "structured bindings only available with" "" { target c++14_down } }
  d.baz<double> ();
}

int
main ()
{
  foo<int> ();
}