[Issue 6683] New: Skipping declaration with goto resulted in nonsense
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Sep 16 16:53:57 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6683
Summary: Skipping declaration with goto resulted in nonsense
Product: D
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: minor
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: destructionator at gmail.com
--- Comment #0 from Adam D. Ruppe <destructionator at gmail.com> 2011-09-16 16:53:35 PDT ---
I'm in the middle of a project right now so will be brief and can add more
later.
Given code like such:
====
auto somethingResult = getSomething();
if(somethingResult.empty)
goto dont_have_something;
auto something = somethingResult.front;
dont_have_something:
if(something !is null) {
// potential problem here if the result was empty - "something" doesn't
refer to what I thought it would!
}
=======
The goto over the variable declaration probably should have been a compile
error, I believe, from the spec. This was kinda a pain to find when it started
crashing since the variable actually referred to an entirely different object!
I'm using last month's dmd too, so possible it's already been fixed. I just
want to post something here before I forget about it.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list