Bug 9929 – Need 'this' when accessing field passed per alias
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-13T11:20:00Z
Last change time
2013-04-13T14:08:20Z
Keywords
rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2013-04-13T11:20:56Z
Found when implementing fix for Issue 7666:
import std.typecons;
import std.typetuple;
auto reverse(T)(T t)
if (isTuple!T)
{
return tuple(Reverse!(t.expand)); // fail
auto x = t.expand; // workaround
return tuple(Reverse!(x)); // ok
}
void main()
{
auto tup = tuple(1, "2");
reverse(tup);
}
Comment #1 by timon.gehr — 2013-04-13T13:57:23Z
This issue is not specific to tuples.
struct S{ int x; }
template ID(alias T){ alias T ID; }
auto foo(){
S s;
auto a = ID!(s.x); // error
auto x = s.x;
auto b = ID!x; // ok
}
Comment #2 by andrej.mitrovich — 2013-04-13T14:08:20Z
Pretty sure that this is then a dupe of Issue 6842.
*** This issue has been marked as a duplicate of issue 6842 ***