public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/93805] [8/9/10 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b
[not found] <bug-93805-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-11 19:20 ` ppalka at gcc dot gnu.org
2020-03-12 14:05 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-03-11 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93805
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |ppalka at gcc dot gnu.org
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Looking into it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/93805] [8/9/10 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b
[not found] <bug-93805-4@http.gcc.gnu.org/bugzilla/>
2020-03-11 19:20 ` [Bug c++/93805] [8/9/10 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b ppalka at gcc dot gnu.org
@ 2020-03-12 14:05 ` ppalka at gcc dot gnu.org
2020-03-23 20:12 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-03-12 14:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93805
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Reduced test case:
$ cat 93805.C
struct B
{
B() {}
};
struct C
{
B b = B();
};
C c;
$ g++ -Wnoexcept 93805.C
93805.C:11:3: warning: noexcept-expression evaluates to ‘false’ because of a
call to ‘B::B()’ [-Wnoexcept]
11 | C c;
| ^
93805.C:3:3: note: but ‘B::B()’ does not throw; perhaps it should be declared
‘noexcept’
3 | B() {}
| ^
The commit in question adds a complain parameter to get_defaulted_eh_spec and
passes it down to synthesized_method_walk, and we eventually call
expr_noexcept_p in walk_field_subops with complain=tf_warning_or_error instead
of with complain=tf_none originally, which is the immediate cause of the
warning.
We're calling expr_noexcept_p from there to determine whether the NSDMI of C::b
is noexcept (so that we can determine the exception specification of C's
synthesized default constructor), and we're warning because the NSDMI of C::b
is not noexcept, but it could be if the non-throwing ctor B::B were marked
noexcept.
ISTM we can either disable the -Wnoexcept warning here, or we can keep the
warning but improve the warning message in this case.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/93805] [8/9/10 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b
[not found] <bug-93805-4@http.gcc.gnu.org/bugzilla/>
2020-03-11 19:20 ` [Bug c++/93805] [8/9/10 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b ppalka at gcc dot gnu.org
2020-03-12 14:05 ` ppalka at gcc dot gnu.org
@ 2020-03-23 20:12 ` cvs-commit at gcc dot gnu.org
2020-03-23 20:16 ` [Bug c++/93805] [8/9 " ppalka at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-23 20:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93805
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:1f6c1c82eb5001a844b5ac535f6aba4a3257031f
commit r10-7345-g1f6c1c82eb5001a844b5ac535f6aba4a3257031f
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Mar 13 14:30:39 2020 -0400
c++: Avoid a suspicious -Wnoexcept warning [PR93805]
In this PR we're emitting -Wnoexcept warnings about potentially-throwing
NSDMIs
when computing the noexcept specification of a class's defaulted default
constructor. Although these warnings are in some sense valid, this patch
takes
the route of suppressing them, because:
1. the warning message is confusing in its current form;
2. warning for 'struct C { B b = B(); };' but not for 'struct C { B b;
};'
is inconsistent; and
3. emitting a warning here arguably doesn't fall under the umbrella of
-Wnoexcept, whose documentation says it warns only when a
noexcept-expression evaluates to false, but there are no
noexcept-expressions here.
gcc/cp/ChangeLog:
PR c++/93805
* except.c (maybe_noexcept_warning): Add TODO comment.
* method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
gcc/testsuite/ChangeLog:
PR c++/93805
* g++.dg/warn/Wnoexcept2.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/93805] [8/9 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b
[not found] <bug-93805-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-03-23 20:12 ` cvs-commit at gcc dot gnu.org
@ 2020-03-23 20:16 ` ppalka at gcc dot gnu.org
2021-05-14 9:52 ` [Bug c++/93805] [9 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-03-23 20:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93805
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[8/9/10 Regression] A |[8/9 Regression] A
|suspicious -Werror=noexcept |suspicious -Werror=noexcept
|warning since |warning since
|r8-2461-g9fb82e652cee118b |r8-2461-g9fb82e652cee118b
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/93805] [9 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b
[not found] <bug-93805-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2020-03-23 20:16 ` [Bug c++/93805] [8/9 " ppalka at gcc dot gnu.org
@ 2021-05-14 9:52 ` jakub at gcc dot gnu.org
2021-06-01 8:16 ` rguenth at gcc dot gnu.org
2022-05-27 8:44 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14 9:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93805
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|8.5 |9.4
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/93805] [9 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b
[not found] <bug-93805-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2021-05-14 9:52 ` [Bug c++/93805] [9 " jakub at gcc dot gnu.org
@ 2021-06-01 8:16 ` rguenth at gcc dot gnu.org
2022-05-27 8:44 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01 8:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93805
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.4 |9.5
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/93805] [9 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b
[not found] <bug-93805-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2021-06-01 8:16 ` rguenth at gcc dot gnu.org
@ 2022-05-27 8:44 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 8:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93805
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Target Milestone|9.5 |10.0
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for GCC 10.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-05-27 8:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-93805-4@http.gcc.gnu.org/bugzilla/>
2020-03-11 19:20 ` [Bug c++/93805] [8/9/10 Regression] A suspicious -Werror=noexcept warning since r8-2461-g9fb82e652cee118b ppalka at gcc dot gnu.org
2020-03-12 14:05 ` ppalka at gcc dot gnu.org
2020-03-23 20:12 ` cvs-commit at gcc dot gnu.org
2020-03-23 20:16 ` [Bug c++/93805] [8/9 " ppalka at gcc dot gnu.org
2021-05-14 9:52 ` [Bug c++/93805] [9 " jakub at gcc dot gnu.org
2021-06-01 8:16 ` rguenth at gcc dot gnu.org
2022-05-27 8:44 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).