Summary: Make alias to expression an error even if it's not
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from Andrej Mitrovic <> 2011-09-27 
17:19:05 PDT ---
This will rightly not compile:

struct Foo { int x; }
struct Bar
    Foo foo;
    alias foo.x x;

void main()
    Bar bar;
    bar.x = 5;

However, if you comment out the "bar.x = 5" line you won't get a compile error.
My main problem with this is that I could easily create an invalid alias by
accident (due to generic programming) and I won't spot this until I try using
an aliased field later down the road. By then I'll end up getting compilation
errors which are hard to figure out (due to e.g. multiple aliasing). And yes,
that has just happened to me. :)

So I'd like this to be a compilation error regardless if that alias is used or
not by client code. As far as I know expression aliases are illegal, unless
that changes it would be great if this was enforced right away.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to