[Issue 5976] New: "variable used before set" with foreach with ref + scope(failure) + structure method + -O

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 10 15:42:19 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5976

           Summary: "variable used before set" with foreach with ref +
                    scope(failure) + structure method + -O
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thecybershadow at gmail.com


--- Comment #0 from Vladimir <thecybershadow at gmail.com> 2011-05-10 15:38:19 PDT ---
When compiled with -O: test.d(9): Error: variable b used before set

struct B { void bar(){} }
B[] barr;

void foo()
{
    foreach (ref b; barr)
    {
        scope(failure)
            b.bar();
        assert(&b); // do anything with b
    }
}

-- 
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