This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: exception specifications
> Maybe I'm thinking about this too hard, but G++ does not seem to be
> paying close attention to 15.4/7
Taking the text of the standard literally, I'd agree that g++ is in
error. However, it seems that paragraph is poorly worded, so I think
we should clarify it first before taking action.
> Looking at fn3, that is throwing type 'Y *', yet the exception
> specification is 'X const * const', that's not an X or X *, so
> shouldn't the final sentance of 15.4/7 apply (exact match)?
It seems they've totally forgotten about cv qualifiers in that
paragraph. Consider
struct Y{};
struct Z:Y{
static Z const* make_z();
};
void foo()throw(Y const*)
{
throw Z::make_z();
}
Should that call unexpected()? I think the spirit of the spec says it
shouldn't, yet the words say it should, since it is not a pointer of
the form Y* (for a class Y).
Regards,
Martin