gcc/testsuite/g++.dg/ext/oper1.C
raw| 1 | // { dg-do run } |
| 2 | |
| 3 | // Copyright 2002 Free Software Foundation |
| 4 | // Contributed by Jason Merrill <[email protected]> |
| 5 | |
| 6 | // Make sure the GNU extension of accepting dropping cv-qualifiers for |
| 7 | // the implicit this argument does not kick in when taking the address |
| 8 | // of an object, since this extension would change the meaning of a |
| 9 | // well-defined program. |
| 10 | |
| 11 | struct A { |
| 12 | A* operator&() { return 0; } |
| 13 | }; |
| 14 | |
| 15 | int main () |
| 16 | { |
| 17 | const A a = {}; |
| 18 | return (&a == 0); |
| 19 | } |