Instantiation of forward referenced class from template mixin

Jarrett Billingsley kb3ctd2 at yahoo.com
Sun Jan 13 07:00:31 PST 2008


"Jan" <danijans03 at student.kau.se> wrote in message 
news:fmcsgc$ub7$1 at digitalmars.com...
> Why does the code below generate the linking error undefined reference to 
> <class>
>
> template ok(T)
> {
> class T
> {
> }
> }
>
> class test;
> mixin ok!(test);
>
> void main()
> {
> test t = new test();
> }

To be honest I have _no_ idea what you're trying to do here.  I'm actually 
kind of surprised that the compiler allows this code to be compiled.

Are you trying to use mixins as some sort of substitute for C macros?  In 
either case, what's with the "class test;"?  You don't need function or 
class prototypes.

Why don't you explain what you're trying to do, and we'll try to come up 
with a solution? 




More information about the Digitalmars-d-learn mailing list