Ticket #175 (new defect)

Opened 10 months ago

Last modified 2 months ago

Imports in classes/structs/templates are not recognized

Reported by: Mauer Assigned to: Gregor
Priority: major Milestone:
Component: Rebuild Version:
Keywords: Cc: deewiant

Description

class Foo {
    import foo.bar;
}

results in linker errors.

import foo.bar;
class Foo {
}

works.

Change History

08/18/08 10:22:56 changed by Deewiant

  • cc set to deewiant.
  • summary changed from Imports in classes are not recognized to Imports in classes/structs/templates are not recognized.

Somewhat more annoyingly this also happens with templates, where you actually need the import in there if you're using it as a mixin:

module foo;
template Foo() {
	import tango.io.Stdout;
	void foo() { Stdout("HELLO").newline; }
}
import foo;
mixin Foo!();
void main() { foo(); }

This can be worked around by putting the import both inside and outside the aggregate, though this might in turn cause unwanted collisions since there's extra stuff in the outer namespace.