Thread overview
[Issue 6842] New: Can't use alias of instance member
Oct 23, 2011
Nick Sabalausky
Oct 23, 2011
Kenji Hara
Oct 23, 2011
timon.gehr@gmx.ch
Oct 23, 2011
Kenji Hara
Dec 02, 2012
Andrej Mitrovic
Dec 02, 2012
Andrej Mitrovic
Dec 02, 2012
Andrej Mitrovic
Apr 13, 2013
Andrej Mitrovic
October 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6842

           Summary: Can't use alias of instance member
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: cbkbbejeap@mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-10-22 18:14:44 PDT ---
--------------------------------
struct Foo
{
    int a;
}

Foo foo;
alias foo.a b;

void main()
{
    b = 5;  // <-- Error
}
--------------------------------

>dmd test.d
test.d(11): Error: need 'this' to access member a

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6842


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |
           Severity|normal                      |enhancement


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-10-22 22:28:33 PDT ---
This is an enhancement, not "rejects-valid".
Because foo.a is an expression, and it is neither type nor symbol.

http://d-programming-language.org/declaration.html AliasDeclaration allows type or symbol as the first argument.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6842


timon.gehr@gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr@gmx.ch


--- Comment #2 from timon.gehr@gmx.ch 2011-10-23 01:10:41 PDT ---
(In reply to comment #1)
> This is an enhancement, not "rejects-valid".
> Because foo.a is an expression, and it is neither type nor symbol.
> 
> http://d-programming-language.org/declaration.html AliasDeclaration allows type or symbol as the first argument.

If foo.a is not a symbol, why does alias foo.a b; compile without an error?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6842



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-10-23 02:21:48 PDT ---
(In reply to comment #2)
> If foo.a is not a symbol, why does alias foo.a b; compile without an error?

Now compiler treats foo.a as Foo.a, and Foo.a is a symbol. I think this is "accepts-invalid" bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6842


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-02 11:29:39 PST ---
*** Issue 9105 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6842


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ellery-newcomer@utulsa.edu


--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-02 11:30:55 PST ---
*** Issue 8051 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6842


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-02 11:31:08 PST ---
*** Issue 6619 has been marked as a duplicate of this issue. ***

-- 
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=6842



--- Comment #7 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-04-13 14:08:20 PDT ---
*** Issue 9929 has been marked as a duplicate of this issue. ***

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