This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

238. Contradictory results of stringbuf initialization.

Section: 31.8.2.2 [stringbuf.cons] Status: CD1 Submitter: Dietmar Kühl Opened: 2000-05-11 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [stringbuf.cons].

View all issues with CD1 status.

Discussion:

In 27.7.1.1 paragraph 4 the results of calling the constructor of 'basic_stringbuf' are said to be str() == str. This is fine that far but consider this code:

  std::basic_stringbuf<char> sbuf("hello, world", std::ios_base::openmode(0));
  std::cout << "'" << sbuf.str() << "'\n";

Paragraph 3 of 27.7.1.1 basically says that in this case neither the output sequence nor the input sequence is initialized and paragraph 2 of 27.7.1.2 basically says that str() either returns the input or the output sequence. None of them is initialized, ie. both are empty, in which case the return from str() is defined to be basic_string<cT>().

However, probably only test cases in some testsuites will detect this "problem"...

Proposed resolution:

Remove 27.7.1.1 paragraph 4.

Rationale:

We could fix 27.7.1.1 paragraph 4, but there would be no point. If we fixed it, it would say just the same thing as text that's already in the standard.