D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2926 - bug in alias this with mutually recursive structs
Summary: bug in alias this with mutually recursive structs
Status: RESOLVED WORKSFORME
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: 2009-05-02 21:41 UTC by Andrei Alexandrescu
Modified: 2012-02-20 03:24 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2009-05-02 21:41:52 UTC
struct A(T)
{
    B!T fun()
    {
        return B!T.init;
    }
}

struct B(T)
{
    private A!T _s;
    alias _s this;
}

void main() {
    A!(int) s;
}

./test.d(15): Error: alias this there can be only one alias this
./test.d(6): Error: template instance test.B!(int) error instantiating
./test.d(15): Error: alias this there can be only one alias this
Comment 1 yebblies 2012-02-20 03:24:40 UTC
This seems to work in dmd 2.058