This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
throw specs on Standard destructors
- From: Kenny Simpson <theonetruekenny at yahoo dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Sat, 7 Dec 2002 19:49:05 -0800 (PST)
- Subject: throw specs on Standard destructors
Greetings,
I recently ran into a potential problem with the lack
of throw specs on destructors for auto_ptr and
basic_string.
Simple example:
#include <string>
struct Base
{
virtual ~Base() throw() {}
};
struct Der : Base
{
std::string foo;
};
int main()
{
Der d;
}
The problem here is that the default destructor for
Der will have a throw spec which is the union of all
bases and members. Since std::basic_string has no
throw spec, Der::~Der also will have none, which
violates Base's destructor's spec.
My local work-around was to add the empty throw spec
to basic_string, but I'm not clear if this is an
ABI-breaking change, or if there is some other
subtlety here. I can't find the ABI FAQ for this.
I would assume the same should be done for auto_ptr.
This was tested with 3.2.1.
-Kenny
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com