Bug 6619 – Forward a single field to a subfield, like "alias this"
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-07T07:18:00Z
Last change time
2012-12-02T11:31:08Z
Assigned to
nobody
Creator
dlang-bugzilla
Comments
Comment #0 by dlang-bugzilla — 2011-09-07T07:18:12Z
It would be nice if this worked:
struct S1 { int f; }
struct S2
{
S1 s1;
alias s1.f g;
}
The error message, which occurs only when trying to access "g", is also somewhat confusing:
Error: struct test.S2 'f' is not a member
Error: struct test.S2 member f is not accessible
Error: this for f needs to be type S1 not type S2
A more general solution would be to allow aliasing expressions, but it sounds like a large language change which would require some discussion first.
Comment #1 by andrej.mitrovich — 2012-12-02T11:31:08Z
*** This issue has been marked as a duplicate of issue 6842 ***