[Issue 1986] Mixin code from website doesn't compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 25 03:21:41 PDT 2008


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





------- Comment #2 from gide at nwawudu.com  2008-10-25 05:21 -------
This is working in DMD v2.020. The line number is in error message, but the
message is still confusing because GenStruct *is* declared as a string, it
should be declared as an 'invariant char [] GenStruct = ...'.

main.d
------
template GenStruct(string Name, string M1) {
    string GenStruct = "struct " ~ Name ~ "{ int " ~ M1 ~ "; }"; 
}

mixin(GenStruct!("Foo", "bar"));

main.d(5): Error: argument to mixin must be a string, not (GenStruct)


-- 



More information about the Digitalmars-d-bugs mailing list