gcc/testsuite/g++.dg/template/ptrmem33.C
raw| 1 | // PR c++/108104 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct A { |
| 5 | void x(); |
| 6 | void y(); |
| 7 | }; |
| 8 | |
| 9 | enum State { On }; |
| 10 | |
| 11 | template<State state, void (A::*)()> |
| 12 | struct B { |
| 13 | static void f(); |
| 14 | }; |
| 15 | |
| 16 | template<State state> |
| 17 | struct B<state, nullptr> { |
| 18 | static void g(); |
| 19 | }; |
| 20 | |
| 21 | template<State state> |
| 22 | struct B<state, &A::y> { |
| 23 | static void h(); |
| 24 | }; |
| 25 | |
| 26 | int main() { |
| 27 | B<State::On, &A::x>::f(); |
| 28 | B<State::On, nullptr>::g(); |
| 29 | B<State::On, &A::y>::h(); |
| 30 | } |