https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4898

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |87403
            Summary|adding an option to verify  |adding an option to verify
                   |exception specifications    |exception specifications
                   |                            |[-Wexceptions]

--- Comment #8 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #7)
> (In reply to Martin Sebor from comment #2)
> > I agree a new warning would be useful. For example, the following code 
> > should
> > be diagnosed:
> > 
> > struct S { S () throw () { throw 0; } };
> 
> This is still relevant in current standards, where throw() is equivalent to
> noexcept.
> 
> Clang warns:
> 
> throw.cc:1:28: warning: 'S' has a non-throwing exception specification but
> can still throw [-Wexceptions]
> struct S { S () throw () { throw 0; } };
>                            ^
> throw.cc:1:12: note: function declared non-throwing here
> struct S { S () throw () { throw 0; } };
>            ^    ~~~~~~~~
> 1 warning generated.
> 

Having a -Wexceptions like clang's would be a useful new warning; thus, making
this block the new-warning meta-bug


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403
[Bug 87403] [Meta-bug] Issues that suggest a new warning

Reply via email to