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

Modified the test to use NULL instead of literal zero.


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>


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>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to