D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6508 - alias this doesn't work with AssignExp rhs
Summary: alias this doesn't work with AssignExp rhs
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-08-16 12:32 UTC by Kenji Hara
Modified: 2011-08-25 13:02 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2011-08-16 12:32:33 UTC
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 Kenji Hara 2011-08-16 12:35:18 UTC
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);
}