Summary: | [DR 2256] Can't jump into scope of a variable with a nontrivial destructor in C++20 | ||
---|---|---|---|
Product: | gcc | Reporter: | Joseph C. Sible <josephcsible> |
Component: | c++ | Assignee: | Patrick Palka <ppalka> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ppalka, webrown.cpp |
Priority: | P3 | Keywords: | rejects-valid |
Version: | 11.2.1 | ||
Target Milestone: | 14.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2021-11-05 00:00:00 | |
Bug Depends on: | |||
Bug Blocks: | 94404 |
Description
Joseph C. Sible
2021-11-05 06:29:55 UTC
Confirmed. The C++ spec was changed by DR2256 which is consider CD5. (In reply to Andrew Pinski from comment #2) > which is consider CD5. That's just a detail of which draft of was included in, which doesn't mean much. More relevant is that it was approved as a DR so it applies to C++17 (and earlier) too. The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:b81785eacef2a28e17e17141fcd334f51640feec commit r14-563-gb81785eacef2a28e17e17141fcd334f51640feec Author: Patrick Palka <ppalka@redhat.com> Date: Sun May 7 12:09:03 2023 -0400 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. Fixed for GCC 14, thanks for the report. |