| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | #include <ostream> |
| 4 | |
| 5 | struct CustomStream : std::ostream {}; |
| 6 | |
| 7 | namespace N { |
| 8 | class A{}; |
| 9 | } |
| 10 | |
| 11 | std::ostream& operator<<(std::ostream& s, const N::A&) |
| 12 | { |
| 13 | return s; |
| 14 | } |
| 15 | |
| 16 | CustomStream&& operator<<(CustomStream&& s, const N::A& v) |
| 17 | { |
| 18 | static_cast<std::ostream&>(s) << v; |
| 19 | return std::move(s); |
| 20 | } |
| 21 | |
| 22 | void test_pr99692() |
| 23 | { |
| 24 | // PR libstdc++/99692 |
| 25 | CustomStream() << N::A{}; |
| 26 | } |
| 27 | |
| 28 | int test_shift_ios_enum() |
| 29 | { |
| 30 | // https://gcc.gnu.org/pipermail/libstdc++/2021-May/052507.html |
| 31 | int i = 1 << std::ios::erase_event; |
| 32 | |
| 33 | return i; |
| 34 | } |