llvm-project/libcxx/test
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
..
libcxx [libc++] Shrink variant's index type when possible 2017-11-19 04:19:44 +00:00
std [libcxx] Fix basic_stringbuf constructor 2017-12-13 18:12:55 +00:00
support [libcxx] [test] Fix MSVC warnings, null pointer deref. 2017-12-13 00:51:27 +00:00
CMakeLists.txt Include AddLLVM needed for tests in the right context 2017-12-01 03:16:50 +00:00
lit.cfg Move libcxx/test/libcxx python package into libcxx/utils/libcxx. 2017-02-09 23:18:11 +00:00
lit.site.cfg.in [libc++][CMake] Use debug MSVC runtimes when libc++ is built in debug mode 2017-01-14 07:54:39 +00:00
nothing_to_do.pass.cpp Test commit: Reverting whitespace changes 2014-07-17 05:10:03 +00:00