gcc/testsuite/g++.old-deja/g++.mike/p3060c.C
raw| 1 | // { dg-do assemble } |
| 2 | // A new problem with my pointer to member function work. |
| 3 | // prms-id: 3060 |
| 4 | |
| 5 | class Foo |
| 6 | { |
| 7 | public: |
| 8 | int x; |
| 9 | int y; |
| 10 | Foo (int i, int j) { x = i; y = j; } |
| 11 | operator int (); |
| 12 | }; |
| 13 | |
| 14 | int Foo::operator int() { return x; } // { dg-error "return" } can't specify return type |
| 15 | |
| 16 | Foo foo(10, 11); |
| 17 | |
| 18 | int |
| 19 | main() |
| 20 | { |
| 21 | int Foo::* pmi = &Foo::y; |
| 22 | return foo.*pmi; |
| 23 | } |