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

           Summary: Missed with() anti-hijacking
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2013-02-16 07:25:57 PST ---
void foo() {}
enum E { foo }
void main() {
    E e;
    final switch (e) with (E) {
        foo: foo(); break;
    }
}


DMD 2.062beta gives:

temp.d(6): Error: function expected before (), not cast(E)0 of type E
temp.d(5): Error: enum member foo not represented in final switch


But I expect only one different error message, similar to:

temp.d(5): Error: with symbol temp.E.foo is shadowing global symbol temp.foo


Similar to:

struct Foo { int x; }
void main() {
    int x;
    Foo f;
    with (f) {
        x++;
    }
}

temp.d(6): Error: with symbol temp.Foo.x is shadowing local symbol temp.main.x

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to