Summary: Circular Import dependencies
           Product: D
           Version: 2.030
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD

Created an attachment (id=398)
 --> (
reproduceable error

In order for the dnet (D dot net compiler based on dmd front end) to work,
import files for the dot net declarations must be generated. According to this
page forward declarations are a
feature to drop from C/C++ but this needs to be implemented to the full extent
for dnet compiler to parse anything.

Sometimes types don't depend on each other at the same but other types within
their namespace depend on them and the import statements cause the error. I
have reduced this down to a simple example which I have attached as
test-forward.rar. In this example compile test.d using 2.030 dmd.

C:\d\phobos\dmd\projects\test-forward>dmd test.d
two.d(5): Error: template instance forward reference to template declaration
two.d(5): Error: A!(B) is used as a type
two.d(5): Error: class two.B base type must be class or interface, not void

test.d imports one.d
one.d imports two.d
two.d imports and actually depends on one.d

when dmd reaches the "import two;" from the file "one.d" it decides that
"two.d" is required to parse the remaing contents but it is infact the other
way round.

The dependency parsing needs to be rethinked from scratch. Not sure the exacts
of the algorithm but maybe create stub declarations that gradually get more
details added to them during the parsing and only check for errors once
everything is in place. I think this is how dot net would compile everything as
the whole dot net platform is very tightly interlinked.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to