Hello there,
I got a weird compilation error which was hard to debug (even for
just a little program) and I thought, this is quite related to
this thread. This is my error message:
```
***search.d(42,1): Error: class ***.XXX has forward references
***box.d(21,32): Error: template instance *** error instantiating
***.d(16,2): instantiated from here: ...
...
```
It was odd, the fix was not obvious and the compiler didn't show
me the place of the erroneous forward reference. The problem was
a scoped `import` statement!! I had put the import statement for
the Box class into the abstract base class Search, the only place
where it is used, but this seems to cause a mess with many
errors. The imported Box uses a sub class of Search as parameter
type and since Search is extended by its subclasses it creates a
circular reference in the subclass. The only way to fix was
putting the import outside of the abstract base class (I assume
because the import statement literally imports the Box together
with the used subclass into Search itself).
The lesson is, you cannot put your import just everywhere.