When studying the sample code for this question I had assumed it was Undefined Behaviour which was preventing subsequent uses of std::cout from printing. But it
std::cout
gcc ostream.tcc line 319:
ostream.tcc
template basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) { if (!__s) __out.setstate(ios_base::badbit);
gcc is simply performing a check that the standard does not guarantee, which is fine because it's undefined anyway.