llvm-project/libcxx
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
..
benchmarks [libcxx] [test] Fix line endings, avoid unnecessary non-ASCII. 2017-12-13 00:51:31 +00:00
cmake Fix installation of cxxabi.h through libc++. 2017-11-25 23:39:17 +00:00
docs Corrected a typo in the building libc++ docs 2017-12-03 10:18:35 +00:00
fuzzing Added include for <cassert> 2017-11-08 20:25:47 +00:00
include [libcxx] Fix basic_stringbuf constructor 2017-12-13 18:12:55 +00:00
lib [libc++] Create install-stripped targets 2017-12-06 21:03:42 +00:00
src [libcxx] Support getentropy as a source of randomness for std::random_device 2017-12-01 06:34:33 +00:00
test [libcxx] Fix basic_stringbuf constructor 2017-12-13 18:12:55 +00:00
utils Attempt to fix template depth test failures on older Clang versions 2017-11-19 09:46:34 +00:00
www Add issue 2587, which was missed 2017-12-05 03:51:16 +00:00
.arcconfig [libcxx] Set up .arcconfig to point to new Diffusion CXX repository 2017-12-04 17:55:28 +00:00
.clang-format Make clang-format use C++03 syntax 2017-04-15 02:45:43 +00:00
.gitignore Implement N4606 optional 2016-10-12 07:46:20 +00:00
CMakeLists.txt Include AddLLVM needed for tests in the right context 2017-12-01 03:16:50 +00:00
CREDITS.TXT Update C++2a status and add Glen to CREDITS.TXT. Reviewed as https://reviews.llvm.org/D40379 2017-11-23 14:50:56 +00:00
LICENSE.TXT Update year to 2017 2017-01-03 11:20:43 +00:00
NOTES.TXT Update doc and various cleanup 2016-12-23 20:00:13 +00:00
TODO.TXT Add list of filesystem NB comments to TODO.TXT so they can be tracked separately 2017-03-06 21:23:36 +00:00
appveyor-reqs-install.cmd Update Appveyor LLVM install link to be current and non-broken 2017-11-15 01:37:11 +00:00
appveyor.yml Rename Appveyor install helper script. 2017-05-10 02:43:02 +00:00