[Bug libstdc++/84367] New: [C++11] std::ostringstream stops inserting after multiple call to move assignment operator

2018-02-13 Thread ftingaud at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84367

Bug ID: 84367
   Summary: [C++11] std::ostringstream stops inserting after
multiple call to move assignment operator
   Product: gcc
   Version: 7.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ftingaud at gmail dot com
  Target Milestone: ---

The following code asserts after a few iterations, because oss is no longer
inserting when calling operator<<.
Replacing the move assignment by a clear + str("") works.

#include 
#include 
int main()
{
   std::ostringstream oss;
   for (int i = 0; i < 100; ++i) {
  oss << "abc";
  assert(oss.str() == "abc");
  oss = std::ostringstream();
   }
   return 0;
}

[Bug libstdc++/84367] [C++11] std::ostringstream stops inserting after multiple call to move assignment operator

2018-02-18 Thread ftingaud at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84367

--- Comment #2 from Frederic Tingaud  ---
I reran the test with GCC 7.3, but got the same error:

#include 
#include 
#include 

int test()
{
   std::ostringstream oss;
   std::cerr << "\nRunning with GCC v" << __GNUC__ << "." << __GNUC_MINOR__ <<
"." << __GNUC_PATCHLEVEL__ << " - libc++=" << __GLIBCXX__ << std::endl;
   for (int i = 0; i < 100; ++i) {
  oss << "abc";
  std::cerr << i << " ";
  assert(oss.str() == "abc");
  oss = std::ostringstream();
   }
   return 0;
}

output:

Running with GCC v7.3.0 - libc++=20180125
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
file.cpp:13: int test(): Assertion `oss.str() == "abc"' failed.
Aborted

[Bug libstdc++/84367] [C++11] std::ostringstream stops inserting after multiple call to move assignment operator

2018-02-19 Thread ftingaud at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84367

Frederic Tingaud  changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|DUPLICATE   |---

--- Comment #3 from Frederic Tingaud  ---
Reopening because I reproduced with GCC 7.3. See previous comment for test
case.