1 // Test that we properly extend the lifetime of the initializer_list
2 // array even if the initializer_list is a subobject.
3 // { dg-options -std=c++0x }
6 #include <initializer_list>
8 extern "C" void abort();
14 A(int) { if (do_throw) throw 42; }
15 ~A() { if (!ok) abort(); }
18 typedef std::initializer_list<A> AL;
19 typedef std::initializer_list<AL> AL2;
20 typedef std::initializer_list<AL2> AL3;
27 int main(int argc, const char** argv)
29 do_throw = (argc > 1); // always false, but optimizer can't tell
30 AL ar[] = {{1,2},{3,4}};
32 AL3 al3 = {{{1},{2},{3}}};