Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp0x/initlist6.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
rev | line source |
---|---|
111 | 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 } |