Skip to content

Commit

Permalink
Add workaround for issue 9057, which is equivalent with the before
Browse files Browse the repository at this point in the history
This is not a new workaround. In previous, the forward reference of struct instance fields had been resolved implicitly in  `sd->fields[i].getConstInitializer()`, via `sd->fill()`.
  • Loading branch information
9rnsr committed Sep 13, 2015
1 parent 9004e82 commit 069f570
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/todt.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,16 @@ void membersToDt(AggregateDeclaration *ad, dt_t **pdt,
//printf("\t\t%s has initializer %s\n", vd->toChars(), init->toChars());
if (init->isVoidInitializer())
continue;

/* Because of issue 14666, function local import does not invoke
* semantic2 pass for the imported module, and surprisingly there's
* no opportunity to do it today.
* As a workaround for the issue 9057, have to resolve forward reference
* in `init` before its use.
*/
if (vd->sem < Semantic2Done && vd->scope)
vd->semantic2(vd->scope);

ExpInitializer *ei = init->isExpInitializer();
Type *tb = vd->type->toBasetype();
if (ei && tb->ty == Tsarray)
Expand Down

0 comments on commit 069f570

Please sign in to comment.