https://issues.dlang.org/show_bug.cgi?id=19548
Seb <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #2 from Seb <[email protected]> --- The linker error is different for me if I add -debug to the mix when compiling :D --- foo.o:foo.d:_D76TypeInfo_S3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh__T9IntervalsTAkZQo6__initZ: error: undefined reference to '_D6object__T10RTInfoImplVAmA2i32i8Z4datayG2m' foo.o:foo.d:_D48TypeInfo_S3std3uni__T8CowArrayTSQwQu8GcPolicyZQz6__initZ: error: undefined reference to '_D6object__T10RTInfoImplVAmA2i16i2Z4datayG2m' --- Also as the behavior is different for `-checkaction=C`, I presume it runs into this: https://github.com/dlang/dmd/blob/92408ea7b43f9636a5e5b0426d7c6ffd73576ca2/src/dmd/statementsem.d#L2596 Specifically CallExp needs to be a DotTemplateInstanceExp. So this should be a good start: --- diff --git a/src/dmd/statementsem.d b/src/dmd/statementsem.d index cd7ac9aca..3cb3f01c4 100644 --- a/src/dmd/statementsem.d +++ b/src/dmd/statementsem.d @@ -2602,16 +2602,16 @@ else } else { - Expression sl = new IdentifierExp(ss.loc, Id.empty); - sl = new DotIdExp(ss.loc, sl, Id.object); - sl = new DotIdExp(ss.loc, sl, Id.__switch_error); + Expression objectId = new IdentifierExp(ss.loc, Id.object); Expressions* args = new Expressions(); args.push(new StringExp(ss.loc, cast(char*) ss.loc.filename)); args.push(new IntegerExp(ss.loc.linnum)); - sl = new CallExp(ss.loc, sl, args); - sl.expressionSemantic(sc); + auto tiargs = new Objects(); + auto dt = new DotTemplateInstanceExp(ss.loc, objectId, Id.__switch_error, tiargs); + Expression sl = new CallExp(ss.loc, dt, args); + sl = sl.expressionSemantic(sc); s = new SwitchErrorStatement(ss.loc, sl); } --- However, it still doesn't trigger the instantiation. --
