gcc/testsuite/g++.dg/overload/defarg10.C
raw| 1 | // PR c++/58063 |
| 2 | // { dg-do run } |
| 3 | |
| 4 | struct basic_ios |
| 5 | { |
| 6 | bool operator!() const { return false; } |
| 7 | }; |
| 8 | |
| 9 | struct ostream : virtual basic_ios |
| 10 | { |
| 11 | }; |
| 12 | |
| 13 | int i; |
| 14 | |
| 15 | ostream& operator<<(ostream& os, const char* s) { |
| 16 | ++i; |
| 17 | return os; |
| 18 | } |
| 19 | |
| 20 | ostream cout; |
| 21 | |
| 22 | void f(bool x = !(cout << "hi!\n")) { } |
| 23 | |
| 24 | int main() { |
| 25 | f(); |
| 26 | if (i != 1) |
| 27 | __builtin_abort(); |
| 28 | } |