Skip to content

Commit

Permalink
fix Issue 9417 - "no size yet for forward reference" error with neste…
Browse files Browse the repository at this point in the history
…d structure
  • Loading branch information
9rnsr committed Apr 6, 2013
1 parent fdb8e55 commit 34cd642
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/template.c
Expand Up @@ -6646,6 +6646,8 @@ void TemplateMixin::semantic(Scope *sc)
return;
}

AggregateDeclaration *ad = toParent()->isAggregateDeclaration();

/* The problem is when to parse the initializer for a variable.
* Perhaps VarDeclaration::semantic() should do it like it does
* for initializers inside a function.
Expand All @@ -6654,7 +6656,7 @@ void TemplateMixin::semantic(Scope *sc)

semantic2(sc2);

if (sc->func)
if (sc->func && !ad)
{
semantic3(sc2);
}
Expand Down
17 changes: 17 additions & 0 deletions test/runnable/mixin1.d
Expand Up @@ -1155,6 +1155,22 @@ class B8032b : A8032b
override void f() { }
}

/*********************************************/
// 9417

mixin template Foo9417()
{
void foo() {}
}

void test9417()
{
struct B
{
mixin Foo9417;
}
}

/*******************************************/

int main()
Expand Down Expand Up @@ -1203,6 +1219,7 @@ int main()
test2245();
test2740();
test42();
test9417();

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

0 comments on commit 34cd642

Please sign in to comment.