https://issues.dlang.org/show_bug.cgi?id=22579
Issue ID: 22579 Summary: Unittests defined in a template are instantiated indiscriminately in betterC mode AND cause inscrutable errors Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: and...@erdani.com This is a twofer. A top-level unittest that is not marked with @betterC in Phobos causes no trouble in betterC mode. However, inside a template that's not the case: template canon(string v) { unittest { Object[] arr = [new A(1), new B(), null]; } } If client code instantiates this template the unittest will be materialized. The second bug is that the line above causes an error message without a line or any other information: Error: `TypeInfo` cannot be used with -betterC --