https://issues.dlang.org/show_bug.cgi?id=13478
Issue ID: 13478
Summary: [REG2.066] Templates not emitted when also referenced
in speculative contexts
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: DMD
Assignee: [email protected]
Reporter: [email protected]
---
module a;
import b;
import c;
int main() {
return foo!int();
}
---
module b;
bool foo(T)() {
// Make sure this is not inlined so a.o actually needs
// to reference it.
asm { nop; }
return false;
}
---
module c;
import b;
// Note that foo is only used in the template constraint here,
// so this never causes foo!int to be emitted.
T barImpl(T)(T t) if (is(typeof({ foo!T(); }))) { return t; }
int bar(int a) { return barImpl(a); }
---
Compile with "dmd -inline a.d".
(If it bothers you, you can also do "dmd -c c.d" first and add c.o to the
command line. It shouldn't make a difference and indeed doesn't.)
DMD 2.066 does not emit foo!int to a.o.
--