Mixin Problems with D2.0

Brian White bcwhite at pobox.com
Thu Mar 6 03:02:24 PST 2008


I'm new to D and am playing with D2.0.  When I try to compile the 
example on http://www.digitalmars.com/d/2.0/mixin.html, I get a compiler 
error:

--------------------------------------------------------------
template GenStruct(char[] Name, char[] M1)
{
     const char[] GenStruct = "struct " ~ Name ~ "{ int " ~ M1 ~ "; }";
}

mixin(GenStruct!("Foo", "bar"));
--------------------------------------------------------------
testmixin.d(6): template instance GenStruct!("Foo","bar") does not match 
any template declaration
attribute argument to mixin must be a string, not (GetStruct!("Foo","bar"))
--------------------------------------------------------------

Is there something else needed?

-- Brian


More information about the Digitalmars-d-learn mailing list