[Issue 2125] Moving a template to a separate module breaks compilation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 24 16:52:27 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2125


kamm-removethis at incasoftware.de changed:

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




------- Comment #1 from kamm-removethis at incasoftware.de  2008-05-24 18:52 -------
I think that is desired behaviour. Templates are generally instantiated in the
scope they are declared in, consider:

module A;
void foo(T)() { writefln(); }
--
import A;
import std.stdio;
void main() { foo!(void)(); }

will also fail to compile. 

The appearance of a string mixin doesn't change that behaviour. You can use
template mixins to instantiate templates in a different context.


-- 



More information about the Digitalmars-d-bugs mailing list