Amusing things happen when immutable arguments and circular imports are put together:

----------------------------------------------
module hello;
import test;

struct Strukt {
    Staly* s;
}
----------------------------------------------
module test;
import hello;

immutable struct Staly {
    int a;
}

void f_strukt(Strukt* stk) {
    f_staly(stk.s);    // ups!
}

void f_staly(Staly* s) { }
----------------------------------------------

Error: function test.f_staly (immutable(Staly)* s) is not callable using argument types (Staly*) Error: cannot implicitly convert expression ((*stk).s) of type Staly* to immutable(Staly)*

Am I writing code too weird or is this a compiler bug? The only thing about circular imports on D page is: "Cycles (circular dependencies) in the import declarations are allowed as long as not both of the modules contain static constructors or static destructors." So what I tried to pull off seems fair game.


Tomek

Reply via email to