]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: -Wreturn-type with if (true) throw [PR107310]
authorJason Merrill <jason@redhat.com>
Tue, 14 Mar 2023 16:20:51 +0000 (12:20 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 18 Apr 2023 20:44:26 +0000 (16:44 -0400)
commit0f6d443f0d0dd8a6bab99ab1957df3cd82541b27
treefedcd567f305c2710a471e28c831d6b68deb24d4
parentf483dc1367294d02581e2d98c5f84be4dd67f26b
c++: -Wreturn-type with if (true) throw [PR107310]

I removed this folding in GCC 12 because it was interfering with an
experiment of richi's, but that never went in and the change causes
regressions, so let's put it back.

This reverts commit r12-5638-ga3e75c1491cd2d.

PR c++/107310

gcc/cp/ChangeLog:

* cp-gimplify.cc (genericize_if_stmt): Restore folding
of constant conditions.

gcc/testsuite/ChangeLog:

* c-c++-common/Wimplicit-fallthrough-39.c: Adjust warning.
* g++.dg/warn/Wreturn-6.C: New test.
gcc/cp/cp-gimplify.cc
gcc/testsuite/c-c++-common/Wimplicit-fallthrough-39.c
gcc/testsuite/g++.dg/warn/Wreturn-6.C [new file with mode: 0644]