[Issue 7077] New: mixin statements can invade the enclosing scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 7 05:16:21 PST 2011


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

           Summary: mixin statements can invade the enclosing scope
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2011-12-07 05:16:20 PST ---
compiles, should not compile:

void main(){
    if(0) mixin(q{auto x = 2;});
    writeln(x);
}

does not compile, should compile:

void main(){
    if(0) mixin(q{auto x = 2;});
    auto x = 1;
}

The workaround is to put {...} around the mixin statement.


(For comparison, this does not compile:

void main(){
    if(0) auto x = 2;                                               
    writeln(x);
}

And this does compile:

void main(){
    if(0) auto x = 2;
    auto x = 1;
})

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