llvm-project/libcxx/test/std
Zhihao Yuan 378ae52b10 [libcxx] Fix basic_stringbuf constructor
Summary:
[libcxx] Fix basic_stringbuf constructor

The C++ Standard [stringbuf.cons]p1 defines the effects of the basic_stringbuf
constructor that takes ios_base::openmode as follows:
  Effects: Constructs an object of class basic_stringbuf, initializing the
  base class with basic_streambuf(), and initializing mode with which.
  Postconditions: str() == "".

The default constructor of basic_streambuf shall initialize all its
pointer member objects to null pointers [streambuf.cons]p1.

Currently libc++ calls "str(string_type());" in the aforementioned constructor
setting basic_streambuf's pointers to a non-null value.

This patch removes the call (note that the postcondition str() == ""
remains valid because __str_ is default-initialized) and adds a test checking
that the basic_streambuf's pointers are null after construction.

Thanks Mikhail Maltsev for the patch.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D40707

llvm-svn: 320604
2017-12-13 18:12:55 +00:00
..
algorithms [libcxx] [test] Fix MSVC warnings, null pointer deref. 2017-12-13 00:51:27 +00:00
atomics [libcxx] [test] Untabify, NFC. 2017-07-29 00:55:10 +00:00
containers Fix copy/paste bug in test where we were putting a '3' into a vector<bool>. NFC. 2017-11-26 00:39:59 +00:00
depr Change a bunch of comments from C++1z to C++17. NFC 2017-11-02 15:03:25 +00:00
diagnostics Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065 2017-11-21 21:37:26 +00:00
experimental [libcxx] [test] Strip trailing whitespace. NFC. 2017-12-07 00:50:23 +00:00
input.output [libcxx] Fix basic_stringbuf constructor 2017-12-13 18:12:55 +00:00
iterators [libcxx] Define istream_iterator equality comparison operators out-of-line 2017-12-11 13:54:58 +00:00
language.support Commit tests for changes in revision 319710 2017-12-04 23:04:53 +00:00
localization [libcxx] [test] Fix line endings, avoid unnecessary non-ASCII. 2017-12-13 00:51:31 +00:00
numerics Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065 2017-11-21 21:37:26 +00:00
re Add missing test_macros.h inclusion. 2017-11-21 22:16:57 +00:00
strings [libcxx] [test] Strip trailing whitespace. NFC. 2017-12-07 00:50:23 +00:00
thread Revert commit removing allocator support from packaged_task. Will investigate further 2017-11-27 20:47:54 +00:00
utilities [libcxx] [test] Fix line endings, avoid unnecessary non-ASCII. 2017-12-13 00:51:31 +00:00
nothing_to_do.pass.cpp