* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / initlist-lifetime1.C
blob9b836754f0e0c12dc2c81f315775dcb8a87272b9
1 // Test that we properly extend the lifetime of the initializer_list
2 // array even if the initializer_list is a subobject.
3 // { dg-do run { target c++11 } }
5 #include <initializer_list>
7 extern "C" void abort();
8 bool ok;
10 bool do_throw;
12 struct A {
13   A(int) { if (do_throw) throw 42; }
14   ~A() { if (!ok) abort(); }
17 typedef std::initializer_list<A> AL;
18 typedef std::initializer_list<AL> AL2;
19 typedef std::initializer_list<AL2> AL3;
21 struct B {
22   AL al;
23   const AL& alr;
26 volatile bool always_false = false;
28 int main(int argc, const char** argv)
30   do_throw = always_false;      // always false, but optimizer can't tell
31   AL ar[] = {{1,2},{3,4}};
32   B b = {{5,6},{7,8}};
33   AL3 al3 = {{{1},{2},{3}}};
34   ok = true;