This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH to be lenient about incomplete types in exception-specifiers
On Thu, 05 Sep 2002 20:16:06 +0100, Nathan Sidwell <nathan@codesourcery.com> wrote:
> Hm, do we actually need to check the call site? If we try and catch
> one of the exceptions, you'll get a diagnosic at the catch.
Not currently, we don't.
> The only case that would behave differently would be
>
> struct incomplete;
> void foo () throw (incomplete);
>
> void myfunc ()
> {
> try{
> foo ();
> } catch (...) {
> throw;
> }
> }
>
> your patch has that ill-formed. The rationale for allowing incomplete
> exception specifiers is to force completeness only when necessary.
> What needs a complete type in the above snippet?
Nothing, it's true. But it seemed to me that using the same rules as for
calls would be straightforward and not overly restrictive. The problem
with requiring completeness at the declaration is that it prevents people
from doing things like
struct A;
struct B { void f () throw (A); };
struct A: B { ...
Jason