Consider these three files: --- a.d struct A { int value; } --- b.d struct B { import a : A; } --- test.d void main() { with (B()) A(0); } DMD will say: test.d(5): Error: cannot implicitly convert expression __withSym of type B* to int Despite B() not being necessary or allowed for A().
This code should error about 'A' not being found in 'B' because imports are private by default. For example: void main() { B().A(0); } // prints: 'Error: no property A for type b.B' or using a type instead of a symbol in 'with' statement: void main() { with (B) A(0); } // same error You can make it work by changing: struct B { import a : A; } to: struct B { public import a : A; } I will try to fix the error but I'm not sure whether to change the bug subject or file a new one.
I'm closing this in favor of issue 21353.