Showing with 39 additions and 5 deletions.
  1. +9 −5 src/dstruct.d
  2. +9 −0 test/runnable/ice15176.d
  3. +13 −0 test/runnable/imports/ice15176a.d
  4. +8 −0 test/runnable/imports/ice15176b.d
14 changes: 9 additions & 5 deletions src/dstruct.d
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,26 @@ extern (C++) void semanticTypeInfo(Scope* sc, Type t)
Scope scx;
scx._module = sd.getModule();
getTypeInfoType(t, &scx);
sd.requestTypeInfo = true;
}
else if (!sc.minst)
{
// don't yet have to generate TypeInfo instance if
// the typeid(T) expression exists in speculative scope.
}
else
{
getTypeInfoType(t, sc);
sd.requestTypeInfo = true;

// Bugzilla 15149, if the typeid operand type comes from a
// result of auto function, it may be yet speculative.
unSpeculative(sc, sd);
}
if (!sc || sc.minst)
sd.requestTypeInfo = true;

/* Step 2: If the TypeInfo generation requires sd.semantic3, run it later.
* This should be done even if typeid(T) exists in speculative scope.
* Because it may appear later in non-speculative scope.
*/
if (!sd.members)
return; // opaque struct
Expand Down Expand Up @@ -179,9 +186,6 @@ extern (C++) void semanticTypeInfo(Scope* sc, Type t)
return;
if (sc.flags & (SCOPEctfe | SCOPEcompile))
return;

if (!sc.minst)
return; // don't have to generate TypeInfo inside speculative scope
}

scope FullTypeInfoVisitor v = new FullTypeInfoVisitor();
Expand Down
9 changes: 9 additions & 0 deletions test/runnable/ice15176.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// EXTRA_SOURCES: imports/ice15176a.d imports/ice15176b.d
// COMPILE_SEPARATELY

import imports.ice15176a;

void main()
{
func();
}
13 changes: 13 additions & 0 deletions test/runnable/imports/ice15176a.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module imports.ice15176a;

import imports.ice15176b;

struct Stack(T)
{
T[] data;
}

void func()
{
alias ValStack = Stack!CodepointSet;
}
8 changes: 8 additions & 0 deletions test/runnable/imports/ice15176b.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module imports.ice15176b;

alias CodepointSet = InversionList!();

struct InversionList()
{
uint[] data;
}