Commit 00035ba5 by Benjamin Kosnik

std_stdexcept.h (logic_error::logic_error): Use string object, not reference.


2001-02-26  Benjamin Kosnik  <bkoz@redhat.com>

	libstdc++/1972
	libstdc++/2089
	* include/bits/std_stdexcept.h (logic_error::logic_error): Use
	string object, not reference.
	(runtime_error::runtime_error): Same.

From-SVN: r40082
parent 0349df29
...@@ -28,23 +28,23 @@ ...@@ -28,23 +28,23 @@
void test01() void test01()
{ {
bool test = true; bool test = true;
const char* strlit = "lack of sunlight, no water error"; std::string s("lack of sunlight, no water error");
// XXX work around long-standing, pathalogical, hostility-inducing parser bug // XXX work around long-standing, pathalogical, hostility-inducing parser bug
// std::logic_error obj(std::string(strlit)); // std::logic_error obj(std::string(strlit));
// 1 // 1
std::logic_error obj = std::logic_error(std::string(strlit)); std::logic_error obj = std::logic_error(s);
// 2 // 2
// std::logic_error obj((std::string)strlit); // std::logic_error obj((std::string)strlit);
VERIFY( strcmp(obj.what(), strlit) ); VERIFY( strcmp(obj.what(), s.data()) );
} }
void test02() void test02()
{ {
bool test = true; bool test = true;
std::string s = "lack of sunlight error"; std::string s("lack of sunlight error");
std::domain_error x(s); std::domain_error x(s);
VERIFY( strcmp(x.what(), s.data()) ); VERIFY( strcmp(x.what(), s.data()) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment