This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]