dmd/compiler/test/fail_compilation/fail308.d
Teodor Dutu 276ef2145b
Translate _d_newclass to a template (#14837)
This makes the following changes:
- Add template `_d_newclassT` to `druntime.src.core.lifetime.d`
- Replace lowering of `new C()` to `_d_newclassT!C()`
- Add `lowering` member to `NewExp`. This field stores the above
lowering to be used by e2ir.d
- Keep the old `_d_newclass` hook because it's used by
`TypeInfo_Class.create()`
- Add dummy `_d_newclassT` hook to tests that redefine the `object`
module
- Remove `new MinHeap!(TestType)()` from `fail308.d`. Otherwise the
errror was changed and printed the local path to druntime
- Move `err` to global scope in rt.sections.d to avoid the frontend
lowering
- Account for the `GC.malloc()` called by the template hook in the
`-profile=gc` tests

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-01-27 10:02:10 +02:00

21 lines
334 B
D

// REQUIRED_ARGS: -unittest
/*
TEST_OUTPUT:
---
fail_compilation/fail308.d(18): Error: template instance `object.RTInfo!(TestType)` recursive expansion
---
*/
void main()
{
MinHeap!(int) foo = new MinHeap!(int)();
}
class MinHeap(NodeType)
{
unittest
{
struct TestType {}
MinHeap!(TestType) foo;
}
}