Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 16, 2021 [Issue 21694] Misleading error message and invalid goto error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21694 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> --- Actually, the goto is not legal because it skips the declaration of b. For example, this does not compile: struct A { /*~this() {}*/ } void test(int x) { { A a; goto END; } A b; END: } onlineapp.d(7): Error: goto skips declaration of variable onlineapp.test.b at onlineapp.d(9) Commenting b makes the code compile both with and without the destructor. It seems that the error message somehow gets swallowed. -- |
March 18, 2021 [Issue 21694] Misleading error message and invalid goto error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21694 --- Comment #2 from Răzvan Ștefănescu <rumbu@rumbu.ro> --- The error message is not swallowed because the code is lowered in a 'try {goto} finally', therefore there is no b declaration to jump over in the same scope as goto after lowering. If you replace the goto with a simple return, it is allowed. Skipping b declaration is perfectly legit as long as b destructor is skipped, that's how the return instruction will be lowered: void test(int x) { A a = 0; try { return; } finally a.~this(); A b = 0; b.~this(); } The problem is that the original code is lowered to: void test(int x) { A a = 0; try { goto END; } finally a.~this(); A b = 0; END: b.~this(); } instead of the correct lowering: void test(int x) { A a = 0; try { goto END; } finally a.~this(); A b = 0; b.~this(); END: } By the way, the C++ compiler (MSVC) lowers the same code like this, which is fine: void test(int x) { { A a = {}; ~a; goto END: } A b = {}; ~b; END:; } -- |
December 17, 2022 [Issue 21694] Misleading error message and invalid goto error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21694 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
February 06, 2023 [Issue 21694] Misleading error message and invalid goto error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21694 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@geany.org --- Comment #3 from Nick Treleaven <nick@geany.org> --- run.dlang.io gives: 2.075.1 to 2.087.1: Failure with output: onlineapp.d(7): Error: `goto` skips declaration of variable `onlineapp.test.b` at onlineapp.d(9) Since 2.088.1: Failure with output: onlineapp.d(7): Error: cannot `goto` into `try` block Possibly related to Issue 20096: https://github.com/dlang/dmd/pull/10266 -- |
Copyright © 1999-2021 by the D Language Foundation