dsymbolsem.d (dmd-2.094.0) | : | dsymbolsem.d (dmd-2.094.1) | ||
---|---|---|---|---|
skipping to change at line 5928 | skipping to change at line 5928 | |||
// Get the instantiating module from the scope minst | // Get the instantiating module from the scope minst | |||
tempinst.minst = sc.minst; | tempinst.minst = sc.minst; | |||
// https://issues.dlang.org/show_bug.cgi?id=10920 | // https://issues.dlang.org/show_bug.cgi?id=10920 | |||
// If the enclosing function is non-root symbol, | // If the enclosing function is non-root symbol, | |||
// this instance should be speculative. | // this instance should be speculative. | |||
if (!tempinst.tinst && sc.func && sc.func.inNonRoot()) | if (!tempinst.tinst && sc.func && sc.func.inNonRoot()) | |||
{ | { | |||
tempinst.minst = null; | tempinst.minst = null; | |||
} | } | |||
// https://issues.dlang.org/show_bug.cgi?id=21299 | ||||
// If not speculative, this instance should have the same instantiating | ||||
// root module as its enclosing template symbol. This can differ when | ||||
// the enclosing template gets changed from non-root to a root instance | ||||
// in the instantiation graph. When that occurs, this instance also | ||||
// needs to be appended to the root module, otherwise there will be | ||||
// undefined references at link-time. | ||||
if (tempinst.minst && tempinst.tinst) | ||||
{ | ||||
tempinst.minst = tempinst.tinst.minst; | ||||
} | ||||
tempinst.gagged = (global.gag > 0); | tempinst.gagged = (global.gag > 0); | |||
tempinst.semanticRun = PASS.semantic; | tempinst.semanticRun = PASS.semantic; | |||
static if (LOG) | static if (LOG) | |||
{ | { | |||
printf("\tdo semantic\n"); | printf("\tdo semantic\n"); | |||
} | } | |||
/* Find template declaration first, | /* Find template declaration first, | |||
skipping to change at line 6629 | skipping to change at line 6640 | |||
sc2 = sc.push(); | sc2 = sc.push(); | |||
sc2.stc |= ds.storage_class & (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.shared_ | STC.disable); | sc2.stc |= ds.storage_class & (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.shared_ | STC.disable); | |||
} | } | |||
ds.type = ds.type.addSTC(ds.storage_class); | ds.type = ds.type.addSTC(ds.storage_class); | |||
ds.type.resolve(ds.loc, sc2, &e, &t, &s); | ds.type.resolve(ds.loc, sc2, &e, &t, &s); | |||
if (sc2 != sc) | if (sc2 != sc) | |||
sc2.pop(); | sc2.pop(); | |||
if (e) // Try to convert Expression to Dsymbol | if (e) // Try to convert Expression to Dsymbol | |||
{ | { | |||
s = getDsymbol(e); | // TupleExp is naturally converted to a TupleDeclaration | |||
if (!s) | if (auto te = e.isTupleExp()) | |||
s = new TupleDeclaration(te.loc, ds.ident, cast(Objects*)te.exps | ||||
); | ||||
else | ||||
{ | { | |||
if (e.op != TOK.error) | s = getDsymbol(e); | |||
ds.error("cannot alias an expression `%s`", e.toChars()); | if (!s) | |||
t = Type.terror; | { | |||
if (e.op != TOK.error) | ||||
ds.error("cannot alias an expression `%s`", e.toChars()) | ||||
; | ||||
t = Type.terror; | ||||
} | ||||
} | } | |||
} | } | |||
ds.type = t; | ds.type = t; | |||
} | } | |||
if (s == ds) | if (s == ds) | |||
{ | { | |||
assert(global.errors); | assert(global.errors); | |||
ds.type = Type.terror; | ds.type = Type.terror; | |||
s = null; | s = null; | |||
} | } | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 24 lines changed or added |