[PATCH] PR libstdc++/80624 satisfy invariant for char_traits<char16_t>::eof()
Stephan Bergmann
sbergman@redhat.com
Mon May 8 15:41:00 GMT 2017
On 05/08/2017 04:59 PM, Jonathan Wakely wrote:
> On 08/05/17 13:37 +0200, Stephan Bergmann via libstdc++ wrote:
>> To me, it feels like this change is not an improvement over keeping
>> living with the current defect.
>
> So rather than transforming U+FFFF into U+FFFD you'd prefer to write
> nothing instead?
>
> #include <sstream>
> #include <cassert>
>
> int main()
> {
> std::basic_ostringstream<char16_t> s;
> s.put(u'\uFFFF');
> assert( s.str().length() == 1 );
> }
>
> a.out: ex.cc:8: int main(): Assertion `s.str().length() == 1' failed.
> Aborted (core dumped)
>
> With my patch it inserts U+FFFD.
Oh, from what I'd read in this thread I'd naively assumed that today
reading and writing U+FFFF actually succeeds, just some functions return
values so that client code can't distinguish success from failure.
More information about the Libstdc++
mailing list