Just encountered this compilation failure in DMD winx64 2.096, which previously worked in 2.095 and prior versions. Just wondering if it's a bug, or a new issue to keep in mind when importing modules? Sorry for the complex nature of this scenario but I'll try to keep it as simple as possible.
Given the following 4-file setup:
// main.d
import cream;
void main() {}
// cream/package.d
module cream;
public import cream.dcream;
public import cream.callbacks;
// cream/callbacks.d
module cream.callbacks;
import cream;
extern(C++) class CallbackBase {}
// cream/dcream.d
module cream.dcream;
import cream;
import std.container.array;
Array!CallbackBase callbackTracker;
Compilation fails with the following error:
C:\D\dmd2\windows\bin....\src\phobos\std\container\array.d(519): Error: incompatible types for array comparison: const(CallbackBase[])
and const(CallbackBase[])
C:\D\dmd2\windows\bin....\src\phobos\std\container\array.d(189): Error: template instance std.container.array.RangeT!(const(Array!(CallbackBase)))
error instantiating
C:\D\dmd2\windows\bin....\src\phobos\std\container\array.d(528): instantiated from here: RangeT!(Array!(CallbackBase))
cream\dcream.d(4): instantiated from here: Array!(CallbackBase)
It seems I can fix this by changing the order the other modules are imported in package.d like so:
// cream/package.d
module cream;
public import cream.callbacks;
public import cream.dcream;
I'm curious why this worked in prior dmd versions, and if it's something I'll need to worry about going forward when creating complex multi-file modules.