[Issue 9521] New: Missed with() anti-hijacking

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 16 07:25:59 PST 2013


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: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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: -------


More information about the Digitalmars-d-bugs mailing list