Thread overview
[Issue 6737] New: Make alias to expression an error even if it's not used
Sep 28, 2011
Andrej Mitrovic
Sep 30, 2011
yebblies
Apr 13, 2013
Andrej Mitrovic
September 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6737

           Summary: Make alias to expression an error even if it's not
                    used
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 30, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6737


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |yebblies@gmail.com
           Platform|Other                       |All
         OS/Version|Windows                     |All
           Severity|enhancement                 |normal


--- Comment #1 from yebblies <yebblies@gmail.com> 2011-09-30 12:09:22 EST ---
Basically the complement of issue 4206.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 13, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6737


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
           See Also|                            |http://d.puremagic.com/issu
                   |                            |es/show_bug.cgi?id=6842
         Resolution|                            |WONTFIX


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-04-13 14:11:59 PDT ---
I'd prefer this to actually become a valid feature. This is covered by Issue 6842.

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