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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 11 11:08:50 PDT 2008


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


gide at nwawudu.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Mixin code from website     |Mixin code from website
                   |doesn't compiler            |doesn't compile




------- Comment #1 from gide at nwawudu.com  2008-04-11 13:08 -------
The corrected template doesn't compile,  it looks like string
/invariant(char)[]/ prevents compilation, changing the type to 'invariant
char[]' and everything is ok. 

Also the error message doesn't have a line number, so there is probably two
bugs occuring.

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

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

C:\>dmd main.d
attribute argument to mixin must be a string, not (GenStruct)


-- 



More information about the Digitalmars-d-bugs mailing list