gcc/testsuite/g++.dg/template/ptrmem27.C
raw| 1 | // PR c++/61500 |
| 2 | |
| 3 | struct X { |
| 4 | int i; |
| 5 | int j; |
| 6 | |
| 7 | int foo(int X::* ptr); |
| 8 | |
| 9 | template <int X::* ptr> |
| 10 | int bar(); |
| 11 | }; |
| 12 | |
| 13 | int X::foo(int X::* ptr) { |
| 14 | int* p = &(this->*ptr); // OK. |
| 15 | return *p; |
| 16 | } |
| 17 | |
| 18 | template <int X::* ptr> |
| 19 | int X::bar() { |
| 20 | int* p = &(this->*ptr); // gcc 4.9.0: OK in C++98 mode, fails in C++11 mode. |
| 21 | return *p; |
| 22 | } |