c++: -Wreturn-type with if (true) throw [PR107310]
commit71b33f8fb8daa6a7a359f322b24365d9016438fc
authorJason Merrill <jason@redhat.com>
Tue, 14 Mar 2023 16:20:51 +0000 (14 12:20 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 14 Mar 2023 18:45:34 +0000 (14 14:45 -0400)
tree56ec4d9930b6546b13386ae89ef2dfc083e540cd
parent42630fadbe248717859d61c0244c821c32b4e52c
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]