digitalmars.D.bugs - [Issue 1986] New: Mixin code from website doesn't compiler
- d-bugmail puremagic.com (20/20) Apr 10 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1986
- d-bugmail puremagic.com (21/21) Apr 11 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1986
- d-bugmail puremagic.com (13/13) Oct 25 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1986
- d-bugmail puremagic.com (18/18) Dec 16 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1986
- d-bugmail puremagic.com (10/10) Oct 25 2011 http://d.puremagic.com/issues/show_bug.cgi?id=1986
- d-bugmail puremagic.com (15/19) Dec 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1986
http://d.puremagic.com/issues/show_bug.cgi?id=1986 Summary: Mixin code from website doesn't compiler Product: D Version: 2.012 Platform: PC URL: http://www.digitalmars.com/d/2.0/mixin.html OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: bartosz relisoft.com This example from http://www.digitalmars.com/d/2.0/mixin.html doesn’t compile: template GenStruct(char[] Name, char[] M1) { const char[] GenStruct = "struct " ~ Name ~ "{ int " ~ M1 ~ "; }"; } mixin(GenStruct!("Foo", "bar")); --
Apr 10 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1986 gide nwawudu.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Mixin code from website |Mixin code from website |doesn't compiler |doesn't compile 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) --
Apr 11 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1986 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) --
Oct 25 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1986 gide nwawudu.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Added keyword diagnostic and simplified example, should error message should say "test.d(5): Error: argument to mixin must be a *invariant char[]* not (*invariant(char)[]*)"? test.d ------ invariant char[] str1 = "int x1;"; // OK mixin(str1); // OK string str2 = "int x2;"; mixin(str2); // Fails, test.d(5): Error: argument to mixin must be a string, not (str2) --
Dec 16 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1986 Kasumi Hanazuki <k.hanazuki gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bitworld qq.com PDT --- *** Issue 6388 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 25 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1986 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |FIXED 16:04:09 PST ---main.d(5): Error: argument to mixin must be a string, not (GenStruct)is now:Error: variable GenStruct cannot be read at compile timeandError: argument to mixin must be a string,not (str2) is:Error: variable str2 cannot be read at compile time-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2012