www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9521] New: Missed with() anti-hijacking


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

--- Comment #0 from bearophile_hugs 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) {

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: -------
Feb 16 2013