comparison gcc/testsuite/g++.dg/cpp0x/initlist105.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // PR c++/86669
2 // { dg-do run { target c++11 } }
3
4 #include <initializer_list>
5
6 struct S { S (); };
7 struct T : public S {};
8 int cnt;
9 void foo (int) { cnt++; }
10
11 S::S ()
12 {
13 int e = 1, f = 2, g = 3, h = 4;
14
15 for (auto k : { e, f, g, h })
16 foo (k);
17 }
18
19 int
20 main ()
21 {
22 S s;
23 if (cnt != 4)
24 __builtin_abort ();
25 T t;
26 if (cnt != 8)
27 __builtin_abort ();
28 }