Is it a bug ?

Jason Merrill jason@cygnus.com
Mon Dec 8 22:22:00 GMT 1997


>>>>> Alexandre Oliva <oliva@dcc.unicamp.br> writes:

> knizhnik  writes:
>> It looks like bug in compiler (if class A has no constructor then
>> no error message is produced)

> That's because the implicit constructor defined for A won't ever
> throw, that is, it is declared as:

> A::A() throw() {}

More correctly, the implicit constructor is trivial, so it doesn't get
called at all.

> So no exception handling code is inserted there.  Declaring the
> constructor of A as such should help

g++ currently doesn't do any optimization based on throw specs.

> but I believe access control should not be performed at that point.  The
> Nov'97 is not clear about that.

I disagree.  [expr.new] just says that a deallocation function is called;
it gives no indication that this call would be any different from any other
call, so access control should be performed.

Jason



More information about the Gcc mailing list