[PATCH] D40707: [libcxx] Fix basic_stringbuf constructor

Zhihao Yuan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 10:13:35 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL320604: [libcxx] Fix basic_stringbuf constructor (authored by lichray, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D40707?vs=126739&id=126779#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40707

Files:
  libcxx/trunk/include/sstream
  libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp


Index: libcxx/trunk/include/sstream
===================================================================
--- libcxx/trunk/include/sstream
+++ libcxx/trunk/include/sstream
@@ -243,7 +243,6 @@
     : __hm_(0),
       __mode_(__wch)
 {
-    str(string_type());
 }
 
 template <class _CharT, class _Traits, class _Allocator>
Index: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
===================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
@@ -17,6 +17,21 @@
 #include <sstream>
 #include <cassert>
 
+template<typename CharT>
+struct testbuf
+    : std::basic_stringbuf<CharT>
+{
+    void check()
+    {
+        assert(this->eback() == NULL);
+        assert(this->gptr() == NULL);
+        assert(this->egptr() == NULL);
+        assert(this->pbase() == NULL);
+        assert(this->pptr() == NULL);
+        assert(this->epptr() == NULL);
+    }
+};
+
 int main()
 {
     {
@@ -27,4 +42,12 @@
         std::wstringbuf buf;
         assert(buf.str() == L"");
     }
+    {
+        testbuf<char> buf;
+        buf.check();
+    }
+    {
+        testbuf<wchar_t> buf;
+        buf.check();
+    }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40707.126779.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171213/6d6d3ceb/attachment-0001.bin>


More information about the cfe-commits mailing list