[Issue 22579] 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:42:03 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22579
Paul Backus <snarwin+bugzilla at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |snarwin+bugzilla at gmail.com
--- Comment #1 from Paul Backus <snarwin+bugzilla at gmail.com> ---
Here's a full example that reproduces the error:
--- issue22579.d
template canon(string v)
{
unittest
{
class A { this(int n) {} }
class B {}
Object[] arr = [new A(1), new B(), null];
}
}
--- main.d
import issue22579;
alias _ = canon!"";
extern(C) int main() { return 0; }
---
Compile with the following command:
---
dmd -betterC -unittest main.d issue22579.d
---
run.dlang.io link: https://run.dlang.io/is/VtkBvu
--
More information about the Digitalmars-d-bugs
mailing list