gcc/testsuite/g++.dg/other/ptrmem11.C
raw| 1 | // Contributed by Dodji Seketeli <[email protected]> |
| 2 | // Origin PR c++/37093 |
| 3 | |
| 4 | struct A {}; |
| 5 | |
| 6 | template <int A::* p> |
| 7 | int |
| 8 | foo(A* q) |
| 9 | { |
| 10 | return q->*p; |
| 11 | } |
| 12 | |
| 13 | template <typename T> |
| 14 | int |
| 15 | bar(int T::* p) |
| 16 | { |
| 17 | return foo<p>(0);// { dg-error "(not a valid template arg|no matching func|pointer-to-member|could not convert|constant)" } |
| 18 | } |
| 19 | |
| 20 | int i = bar<A>(0); |
| 21 |