October 21, 2016 dmd 2.072.0 beta 2 no size because of forward reference | ||||
|---|---|---|---|---|
| ||||
Hey,
the code bellow compiles with dmd 2.071.2, but doesn't compile with the same command with dmd 2.072.0 beta2. Maybe someone knows what's going wrong or whether it is a bug in 2.071.2/2.072.0 (it is a reduced part from memutils):
app.d:
import memutils.utils;
struct HashMap(Key, Value)
{
int[] m_table; // NOTE: capacity is always POT
~this()
{
freeArray!(int)(m_table);
}
}
----------------------------------------------------------
module memutils.allocators;
final class FreeListAlloc()
{
import memutils.utils : MallocAllocator;
}
----------------------------------------------------------
module memutils.utils;
import memutils.allocators;
final class MallocAllocator
{
}
final class AutoFreeListAllocator()
{
FreeListAlloc!()[12] m_freeLists;
}
alias LocklessAllocator = AutoFreeListAllocator!();
R getAllocator(R)() {
return new R;
}
void freeArray(T)(auto ref T[] array)
{
auto allocator = getAllocator!(LocklessAllocator); // freeing. Avoid allocating in a dtor
}
--------------------------------------------------------
The command to compile:
dmd -c -Imemutils/ app.d -of/dev/null
Builds with the latest stable. Fails with the beta:
memutils/utils.d(9): Error: class memutils.utils.AutoFreeListAllocator!().AutoFreeListAllocator no size because of forward reference
memutils/utils.d(14): Error: template instance memutils.utils.AutoFreeListAllocator!() error instantiating
memutils/utils.d(11): Error: template instance memutils.allocators.FreeListAlloc!() error instantiating
memutils/utils.d(14): instantiated from here: AutoFreeListAllocator!()
app.d(9): Error: template instance memutils.utils.freeArray!int error instantiating
app.d(13): instantiated from here: HashMap!(int, uint)
Compiles with the lates beta if:
dmd -c -Imemutils/ memutils/* app.d -of/dev/null
| ||||
October 21, 2016 Re: dmd 2.072.0 beta 2 no size because of forward reference | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Eugene Wissner | https://github.com/dlang/dmd/pull/5500 maybe this | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply