2002-11-05 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/8466
* include/std/std_sstream.h
(basic_stringbuf::str(const __string_type&)):
Cannot use simple assignment since the COW-nature of v3
basic_string is not taken into account in basic_stringbuf.
* testsuite/27_io/stringstream_members.cc: Add test04 from PR.
From-SVN: r58838
+2002-11-05 Paolo Carlini <pcarlini@unitus.it>
+
+ PR libstdc++/8466
+ * include/std/std_sstream.h
+ (basic_stringbuf::str(const __string_type&)):
+ Cannot use simple assignment since the COW-nature of v3
+ basic_string is not taken into account in basic_stringbuf.
+ * testsuite/27_io/stringstream_members.cc: Add test04 from PR.
+
2002-11-05 John David Anglin <dave@hiauly1.hia.nrc.ca>
* configure.target (hppa*): Define cpu_include_dir.
void
str(const __string_type& __s)
{
- _M_string = __s;
+ // Cannot use _M_string = __s, since v3 strings are COW.
+ _M_string.assign(__s.c_str(), __s.size());
_M_stringbuf_init(_M_mode);
}
std::stringstream ss2(str3, std::ios_base::in|std::ios_base::out);
}
+// libstdc++/8466
+void test04()
+{
+ bool test = true;
+
+ const char* strlit00 = "orvieto";
+ const std::string str00 = strlit00;
+
+ std::ostringstream oss;
+
+ oss.str(str00);
+ oss << "cortona";
+ VERIFY( str00 == strlit00 );
+}
+
int main()
{
test01();
test02();
test03();
+ test04();
return 0;
}