[PATCH] D40707: [libcxx] Fix basic_stringbuf constructor

Mikhail Maltsev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 05:24:26 PST 2017


miyuki updated this revision to Diff 126739.
miyuki added a comment.

Use diff with context.


https://reviews.llvm.org/D40707

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


Index: test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
===================================================================
--- test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
+++ 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();
+    }
 }
Index: include/sstream
===================================================================
--- include/sstream
+++ include/sstream
@@ -243,7 +243,6 @@
     : __hm_(0),
       __mode_(__wch)
 {
-    str(string_type());
 }
 
 template <class _CharT, class _Traits, class _Allocator>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40707.126739.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171213/7d8f8518/attachment.bin>


More information about the cfe-commits mailing list