Bug 6508 – alias this doesn't work with AssignExp rhs
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-08-16T12:32:00Z
Last change time
2011-08-25T13:02:23Z
Keywords
rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2011-08-16T12:32:33Z
This is similar to bug 6369, but different.
template Seq(T...)
{
alias T Seq;
}
void main()
{
int x, y;
Seq!(x, y) = tup(10, 20);
assert(x == 10);
assert(y == 20);
}
Comment #1 by k.hara.pg — 2011-08-16T12:35:18Z
Sorry, Comment#0's sample code is incomplete.
template Seq(T...)
{
alias T Seq;
}
struct Tup(T...)
{
T field;
alias field this;
}
void main()
{
int x, y;
Seq!(x, y) = Tup!(int, int)(10, 20);
assert(x == 10);
assert(y == 20);
}