https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97719

> On Nov 4, 2020, at 11:54 AM, Stephan Bergmann <sberg...@redhat.com> wrote:
> 
> On 07/10/2020 18:55, Thomas Rodgers wrote:
>> From: Thomas Rodgers <trodg...@redhat.com>
>> New ctors and ::view() accessor for -
>>   * basic_stingbuf
>>   * basic_istringstream
>>   * basic_ostringstream
>>   * basic_stringstreamm
>> New ::get_allocator() accessor for basic_stringbuf.
> I found that this 
> <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a0e4d7b44c544c84cffc7ff9c64b6f1af14fb08d>
>  "libstdc++: Implement C++20 features for <sstream>" changed the behavior of
> 
>> $ cat test.cc
>> #include <iostream>
>> #include <iterator>
>> #include <sstream>
>> int main() {
>>  std::stringstream s("a");
>>  std::istreambuf_iterator<char> i(s);
>>  if (i != std::istreambuf_iterator<char>()) std::cout << *i << '\n';
>> }
>> $ g++ -std=c++20 test.cc
>> $ ./a.out
> 
> from printing "a" to printing nothing.  (The `i != ...` comparison appears to 
> change i from pointing at "a" to pointing to null, and returns false.)
> 
> I ran into this when building LibreOffice, and I hope test.cc is a faithfully 
> minimized reproducer.  However, I know little about std::istreambuf_iterator, 
> so it may well be that the code isn't even valid.
> 

Reply via email to