[Bug c++/94112] Please add a warning for potentially throwing code in noexcept function

2021-10-26 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94112

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org
 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #4 from Eric Gallager  ---
dup of bug 61372

*** This bug has been marked as a duplicate of bug 61372 ***

[Bug c++/94112] Please add a warning for potentially throwing code in noexcept function

2020-03-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94112

--- Comment #3 from Jonathan Wakely  ---
That would likely be far too noisy for use 99% of the time.

[Bug c++/94112] Please add a warning for potentially throwing code in noexcept function

2020-03-10 Thread rafael at espindo dot la
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94112

--- Comment #2 from Rafael Avila de Espindola  ---
(In reply to Martin Sebor from comment #1)
> Confirmed with the output below.  -Wterminate is fully implemented in the
> C++ front-end so it doesn't know about what might happen in called
> functions.  Implementing the detection across inlined functions requires
> moving the warning to the middle-end and deciding how to deal with
> situations where the called function throws only under some non-constant
> conditions (e.g., issue -Wterminate regardless, or a -Wmaybe-terminate kind
> of a warning, or none).


I would be happy even with a "noexcept function calls a non-noexcept one"
warning.

[Bug c++/94112] Please add a warning for potentially throwing code in noexcept function

2020-03-10 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94112

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2020-03-10
 CC||msebor at gcc dot gnu.org
 Blocks||87403

--- Comment #1 from Martin Sebor  ---
Confirmed with the output below.  -Wterminate is fully implemented in the C++
front-end so it doesn't know about what might happen in called functions. 
Implementing the detection across inlined functions requires moving the warning
to the middle-end and deciding how to deal with situations where the called
function throws only under some non-constant conditions (e.g., issue
-Wterminate regardless, or a -Wmaybe-terminate kind of a warning, or none).

$ gcc -O2 -Wall -Wextra -S -Wall a.C
void foo () noexcept
{
throw 42;
}

static void bar ()
{
throw 42;
}

void foobar () noexcept
{ 
bar ();
}

a.C: In function ‘void foo()’:
a.C:3:5: warning: ‘throw’ will always call ‘terminate’ [-Wterminate]
3 | throw 42;
  | ^~~~


Referenced Bugs:

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