1 // Basic uses of initializer lists
2 // { dg-do run { target c++11 } }
4 #include <initializer_list>
6 extern "C" void abort();
10 struct A { int i,j; A(int _i,int _j): i(_i), j(_j) {} };
11 struct B { A a; B(A _a): a(_a) {} };
12 struct C { B b; C(B _b): b(_b) {} };
17 D (initializer_list<int> l)
19 const int *p = l.begin();
20 for (int i = 0; i < 3; ++i)
27 if (c.b.a.i != 1) abort();
28 if (c.b.a.j != 2) abort();
34 if (d.ia[0] != 1 || d.ia[1] != 2 || d.ia[2] != 3)
45 if (e.i != 1 || e.j != 2 || e.k != 3)
49 void i(initializer_list<int> l)
51 const int *p = l.begin();
52 if (*p++ != 1) abort();
53 if (*p++ != 2) abort();
54 if (*p++ != 3) abort();
55 if (p != l.end()) abort();
58 struct U { U(int, int) {} };
59 U ua[] = { { 3, 2 } };