https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80662
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- FWIW the original example compiles now, but that's because https://wg21.link/lwg1203 (implemented by r12-319 and in gcc 11.2 by r11-8369) changed the return type to be a reference to the original stream, not the ostream base class. The reduced examples show that the compiler still has the problem, it's just not affecting libstdc++ directly now.