gcc/testsuite/g++.old-deja/g++.other/conv2.C
raw| 1 | // { dg-do assemble } |
| 2 | // { dg-options "-pedantic-errors" } |
| 3 | |
| 4 | void cheat( int* i ) { ++(*i); } |
| 5 | |
| 6 | struct t { |
| 7 | void cheat( int& i ) { ++i; } |
| 8 | }; |
| 9 | |
| 10 | int main() |
| 11 | { |
| 12 | void (t::*member)( const int& ) = &t::cheat; // { dg-error "" } conversion |
| 13 | void (*cheater)( const int* ) = &cheat; // { dg-error "" } converting |
| 14 | t t2; |
| 15 | const int i=1; |
| 16 | int j=1; |
| 17 | (t2.*member)( i ); |
| 18 | (t2.*member)( j ); |
| 19 | } |