```
The exceptions thrown by the libstdc++ and libc++ standard libraries
seems to differ for iostream errors. libstdc++ will output iostream
error while libc++ will output unspecified iostream_category error. This
means that the expected serialization messages [...] don't always work.
```
Backport of core PR18757.