[Issue 22579] New: Unittests defined in a template are instantiated indiscriminately in betterC mode AND cause inscrutable errors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 8 15:13:39 UTC 2021
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: nobody at puremagic.com
Reporter: andrei at 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
--
More information about the Digitalmars-d-bugs
mailing list