]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/g++.dg/cpp0x/initlist6.C
PR c++/92590 - wrong handling of inherited default ctor.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / initlist6.C
1 // Test for initlist lifetime
2 // { dg-do run { target c++11 } }
3
4 #include <initializer_list>
5
6 int c;
7
8 struct A
9 {
10 A(int,int) { ++c; }
11 ~A() { --c; }
12 };
13
14 void f (std::initializer_list<A> l) { }
15
16 int main()
17 {
18 f({ {1,2}, {3,4} });
19 if (c != 0)
20 return 1;
21
22 {
23 std::initializer_list<A> l { {1,2}, {3,4} };
24 if (c != 2)
25 return 2;
26 }
27 if (c != 0)
28 return 3;
29 }
This page took 0.038168 seconds and 5 git commands to generate.