gcc/testsuite/g++.dg/cpp0x/initlist72.C
raw| 1 | // DR 1589 |
| 2 | // { dg-require-effective-target c++11 } |
| 3 | |
| 4 | #include <initializer_list> |
| 5 | |
| 6 | struct Pair |
| 7 | { |
| 8 | Pair(const char *, const char *); |
| 9 | }; |
| 10 | |
| 11 | struct String |
| 12 | { |
| 13 | String(const char *); |
| 14 | }; |
| 15 | |
| 16 | void f1(int); // #1 |
| 17 | int f1(std::initializer_list<long>); // #2 |
| 18 | int g1() { return f1({42}); } // chooses #2 |
| 19 | |
| 20 | void f2(Pair); // #3 |
| 21 | int f2(std::initializer_list<String>); // #4 |
| 22 | int g2() { return f2({"foo","bar"}); } // chooses #4 |