diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-05-07 12:09:03 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-05-07 12:09:03 -0400 |
commit | b81785eacef2a28e17e17141fcd334f51640feec (patch) | |
tree | 69afbea8da959dd329da157f94e9519248541a72 /gcc/testsuite/g++.old-deja | |
parent | b28a7c41fb4697b2d5d9e6e6552b0764bd7d90f0 (diff) | |
download | gcc-b81785eacef2a28e17e17141fcd334f51640feec.zip gcc-b81785eacef2a28e17e17141fcd334f51640feec.tar.gz gcc-b81785eacef2a28e17e17141fcd334f51640feec.tar.bz2 |
c++: goto entering scope of obj w/ non-trivial dtor [PR103091]
It seems ever since DR 2256 goto is permitted to cross the initialization
of a trivially initialized object with a non-trivial destructor. We
already supported this as an -fpermissive extension, so this patch just
makes us unconditionally support this.
DR 2256
PR c++/103091
gcc/cp/ChangeLog:
* decl.cc (decl_jump_unsafe): Return bool instead of int.
Don't consider TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
(check_previous_goto_1): Simplify now that decl_jump_unsafe
returns bool instead of int.
(check_goto): Likewise.
gcc/testsuite/ChangeLog:
* g++.old-deja/g++.other/init9.C: Don't expect diagnostics for
goto made valid by DR 2256.
* g++.dg/init/goto4.C: New test.
Diffstat (limited to 'gcc/testsuite/g++.old-deja')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/init9.C | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/init9.C b/gcc/testsuite/g++.old-deja/g++.other/init9.C index 46d9902..0194cd1 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/init9.C +++ b/gcc/testsuite/g++.old-deja/g++.other/init9.C @@ -24,9 +24,10 @@ struct X { }; void b() { - goto bar; // { dg-message "" } jump from here - X x; // { dg-message "" } jump crosses initialization - bar: // { dg-error "" } jump to here + // This was ill-formed until DR 2256. + goto bar; + X x; + bar: ; } |