gcc/testsuite/g++.old-deja/g++.other/overload7.C
raw| 1 | // { dg-do run } |
| 2 | // Check that object call works when there are multiple conversion ops |
| 3 | // returning the same type. |
| 4 | |
| 5 | typedef int (*pfn)(); |
| 6 | |
| 7 | int zero () { return 0; } |
| 8 | int one () { return 1; } |
| 9 | int two () { return 2; } |
| 10 | |
| 11 | struct A { |
| 12 | A() { } |
| 13 | operator pfn () { return one; } |
| 14 | operator pfn () const { return zero; } |
| 15 | operator pfn () volatile { return two; } |
| 16 | }; |
| 17 | |
| 18 | int |
| 19 | main () |
| 20 | { |
| 21 | const A a; |
| 22 | return a(); |
| 23 | } |