[Issue 24534] Having a label on a declaration makes it possible to skip it with goto
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun May 19 08:37:46 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24534
--- Comment #9 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Richard (Rikki) Andrew Cattermole from comment #7)
> But, it is also desirable to skip variable declarations, as long as you
> don't touch them you do not violate the spec clause.
The spec clause specifically disallows that:
"It is illegal for a GotoStatement to be used to skip initializations."
There's certainly an argument to be made that the rule could be more
fine-grained and require that no variable be accessed whose declaration was
skipped (which would also mean that the variable couldn't have a destructor),
but as the rule currently stands, you can't legally skip variable declarations
whether the variable is then used or not.
--
More information about the Digitalmars-d-bugs
mailing list