This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR libstdc++/80624 satisfy invariant for char_traits<char16_t>::eof()


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]