Skip to content

Commit

Permalink
Merge pull request #5780 from 9rnsr/fix15992
Browse files Browse the repository at this point in the history
[REG2.072a] Issue 15992 - ICE with field variable of instantiated struct
  • Loading branch information
WalterBright committed Jul 10, 2016
2 parents a9b56ba + 201b124 commit 298d010
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dmodule.d
Expand Up @@ -1047,6 +1047,8 @@ extern (C++) final class Module : Package
Dsymbol s = (*members)[i];
//printf("Module %s: %s.semantic3()\n", toChars(), s->toChars());
s.semantic3(sc);

runDeferredSemantic2();
}
if (userAttribDecl)
{
Expand Down
2 changes: 2 additions & 0 deletions src/dtemplate.d
Expand Up @@ -8017,6 +8017,8 @@ extern (C++) class TemplateInstance : ScopeDsymbol
Dsymbols* a = mi.members;
a.push(this);
memberOf = mi;
if (mi.semanticRun >= PASSsemantic2done && mi.isRoot())
Module.addDeferredSemantic2(this);
if (mi.semanticRun >= PASSsemantic3done && mi.isRoot())
Module.addDeferredSemantic3(this);
return a;
Expand Down
34 changes: 34 additions & 0 deletions test/compilable/ice15992.d
@@ -0,0 +1,34 @@
// PERMUTE_ARGS:

struct Appender()
{
bool canExtend = false;
}

struct CustomFloat()
{
union ToBinary
{
CustomFloat!() get;
}

void opAssign(F)(F input)
if (__traits(compiles, cast(real)input))
{
}

real get()()
{
Appender!() app;
assert(false);
}

T opCast(T)() { return get!(); }

alias g = get!();
}

void f()
{
alias FPTypes = CustomFloat!();
}

0 comments on commit 298d010

Please sign in to comment.