Daily bump.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / initlist117.C
blob415a5de2dd1d35cb72b6585bed69a2ede347451e
1 // PR c++/66139
2 // { dg-do run { target c++11 } }
4 #include <initializer_list>
6 int c, d;
8 struct a
10   a (int i) { if (i) throw i; c++; }
11   ~a () { d++; }
14 void check (void (*f) ())
16   try
17   {
18     c = d = 0;
19     f ();
20   }
21   catch (int)
22   {
23     if (c != 1 || d != 1)
24       __builtin_abort ();
25     return;
26   }
27   __builtin_abort ();
30 int main ()
32   struct s { a x, y; };
33   check ([] { s t { 0, 1 }; });
34   check ([] { s { 0, 1 }; });
35   check ([] { a t[2] { 0, 1 }; });
36   using array = a[2];
37   check ([] { array { 0, 1 }; });
38   check ([] { std::initializer_list <a> t { 0, 1 }; });
39   check ([] { std::initializer_list <a> { 0, 1 }; });