Skip to content

Commit

Permalink
fix Issue 13235 - Wrong code on mutually recursive tuple type
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Aug 6, 2014
1 parent d0d95cd commit 7fe769e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/declaration.c
Expand Up @@ -1249,6 +1249,7 @@ void VarDeclaration::semantic(Scope *sc)
v2->parent = this->parent;
v2->isexp = true;
aliassym = v2;
sem = SemanticDone;
return;
}

Expand Down
47 changes: 47 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -3854,6 +3854,52 @@ void test13223()
//static assert(is(typeof(f5(null)) == void[]));
}

/******************************************/
// 13235

struct Tuple13235(T...)
{
T expand;
alias expand field;

this(T values)
{
field = values;
}
}
struct Foo13235
{
Tuple13235!(int, Foo13235)* foo;
}

template Inst13235(T...)
{
struct Tuple
{
T expand;
alias expand field;

this(T values)
{
field = values;
}
}
alias Inst13235 = Tuple*;
}
struct Bar13235
{
Inst13235!(int, Bar13235) bar;
}

void test13235()
{
alias Tup1 = Tuple13235!(int, Foo13235);
assert(Tup1(1, Foo13235()).expand[0] == 1);

alias Tup2 = typeof(*Inst13235!(int, Bar13235).init);
assert(Tup2(1, Bar13235()).expand[0] == 1);
}

/******************************************/
// 13252

Expand Down Expand Up @@ -3982,6 +4028,7 @@ int main()
test12122();
test12207();
test12376();
test13235();

printf("Success\n");
return 0;
Expand Down

0 comments on commit 7fe769e

Please sign in to comment.