gcc/testsuite/g++.dg/cpp0x/pr70869.C
raw| 1 | // PR c++/70869 |
| 2 | // { dg-do run { target c++11 } } |
| 3 | |
| 4 | #include <initializer_list> |
| 5 | |
| 6 | struct A |
| 7 | { |
| 8 | int f () { return 1; } |
| 9 | int g () { return 2; } |
| 10 | int h () { return 3; } |
| 11 | }; |
| 12 | |
| 13 | int |
| 14 | main () |
| 15 | { |
| 16 | int cnt = 0; |
| 17 | for (const auto &m : { &A::f, &A::g, &A::h }) |
| 18 | { |
| 19 | A a; |
| 20 | if ((a.*m) () != ++cnt) |
| 21 | __builtin_abort (); |
| 22 | } |
| 23 | if (cnt != 3) |
| 24 | __builtin_abort (); |
| 25 | } |