Comment #0 by bus_dbugzilla — 2011-10-22T18:14:44Z
--------------------------------
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
Comment #1 by k.hara.pg — 2011-10-22T22:28:33Z
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.
Comment #2 by timon.gehr — 2011-10-23T01:10:41Z
(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?
Comment #3 by k.hara.pg — 2011-10-23T02:21:48Z
(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.
Comment #4 by andrej.mitrovich — 2012-12-02T11:29:39Z
*** Issue 9105 has been marked as a duplicate of this issue. ***
Comment #5 by andrej.mitrovich — 2012-12-02T11:30:55Z
*** Issue 8051 has been marked as a duplicate of this issue. ***
Comment #6 by andrej.mitrovich — 2012-12-02T11:31:08Z
*** Issue 6619 has been marked as a duplicate of this issue. ***
Comment #7 by andrej.mitrovich — 2013-04-13T14:08:20Z
*** Issue 9929 has been marked as a duplicate of this issue. ***
Comment #8 by andrej.mitrovich — 2016-08-28T19:15:42Z
*** Issue 14848 has been marked as a duplicate of this issue. ***
Comment #9 by john.michael.hall — 2023-02-08T20:17:15Z
*** Issue 20895 has been marked as a duplicate of this issue. ***
Comment #10 by razvan.nitu1305 — 2024-08-26T08:19:16Z
*** Issue 24720 has been marked as a duplicate of this issue. ***