gcc/testsuite/g++.dg/cpp0x/initlist106.C
raw| 1 | // PR c++/86669 |
| 2 | // { dg-do run { target c++11 } } |
| 3 | |
| 4 | #include <initializer_list> |
| 5 | |
| 6 | struct A { }; |
| 7 | struct S : virtual public A { S (); }; |
| 8 | struct T : public S, virtual public A {}; |
| 9 | int cnt; |
| 10 | void foo (int) { cnt++; } |
| 11 | |
| 12 | S::S () |
| 13 | { |
| 14 | int e = 1, f = 2, g = 3, h = 4; |
| 15 | |
| 16 | for (auto k : { e, f, g, h }) |
| 17 | foo (k); |
| 18 | } |
| 19 | |
| 20 | int |
| 21 | main () |
| 22 | { |
| 23 | S s; |
| 24 | if (cnt != 4) |
| 25 | __builtin_abort (); |
| 26 | T t; |
| 27 | if (cnt != 8) |
| 28 | __builtin_abort (); |
| 29 | } |