[Issue 21694] Misleading error message and invalid goto error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 16 12:25:41 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21694

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at 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.

--


More information about the Digitalmars-d-bugs mailing list