[Issue 14684] Circular import cases "Must be imported as FileName" error

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 3 13:07:23 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=14684

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to sigsve from comment #0)
> I have a structure
> src
> |-> main.d
> |-> RootClass.d
> |-> MyPackage/
>    |-> PackagedClass.d
> 
> If I add an import in *RootClass* to *myPackage.PackagedClass*, it's fine.

This only works when you compile one file at a time, so the compiler does not
notice the module name discrepancy. The way you build your project is very
unusual, today most D software is built with dub or rdmd.

In short: the compiler is not detecting a problem in your project as an
optimization. When dealing with packages, all modules need to have a module
statement indicating the full name of the module - even if you don't do that
and somehow get things to compile, you will likely get linking errors due to
differences in full mangled names of symbols.

--


More information about the Digitalmars-d-bugs mailing list