digitalmars.D.bugs - [Issue 5394] New: Changing the order of writing pragma(msg, (...).mangleof) changes the result
- d-bugmail puremagic.com (57/57) Dec 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5394
- d-bugmail puremagic.com (40/40) Jun 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5394
- d-bugmail puremagic.com (6/6) Jun 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5394
- d-bugmail puremagic.com (19/20) Jun 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5394
- d-bugmail puremagic.com (7/7) Jun 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5394
- d-bugmail puremagic.com (6/6) Jun 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5394
- d-bugmail puremagic.com (6/6) Jun 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5394
http://d.puremagic.com/issues/show_bug.cgi?id=5394 Summary: Changing the order of writing pragma(msg, (...).mangleof) changes the result Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: wfunction hotmail.com --- Comment #0 from wfunction hotmail.com 2010-12-31 17:18:28 PST --- I have this code below: // Code ================================= private template Dummy(sth...) { struct Hook { } } template myMangledName(sth...) if (sth.length == 1) { enum string myMangledName = Dummy!(sth[0]).Hook.mangleof; pragma(msg, Dummy!().Hook.mangleof); pragma(msg, Dummy!(sth).Hook.mangleof); } class Temp { int Field; pragma(msg, "IGNORE THIS... ", myMangledName!(Field)); } // End Code ============================= When I compile it with DMD 2.051, I get this text printed: IGNORE THIS... S4meta10__T5DummyZ4Hook S4meta4Temp32__T5DummyS19_D4meta4Temp5FieldiZ4Hook S4meta4Temp32__T5DummyS19_D4meta4Temp5FieldiZ4Hook However, if I compile this: // Code ================================= private template Dummy(sth...) { struct Hook { } } template myMangledName(sth...) if (sth.length == 1) { enum string myMangledName = Dummy!(sth[0]).Hook.mangleof; pragma(msg, Dummy!(sth).Hook.mangleof); pragma(msg, Dummy!().Hook.mangleof); //Notice that the above two are switched } class Temp { int Field; pragma(msg, "IGNORE THIS... ", myMangledName!(Field)); } // End Code ============================= I get this result: IGNORE THIS... S4meta4Temp32__T5DummyS19_D4meta4Temp5FieldiZ4Hook S4meta10__T5DummyZ4Hook S4meta4Temp32__T5DummyS19_D4meta4Temp5FieldiZ4Hook which is obviously different from the last one. Is this a bug? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 31 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5394 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-06-01 07:29:04 PDT --- This is not a bug. Test with following code. private template Dummy(sth...) { struct Hook { } } template myMangledName(sth...) if (sth.length == 1) { enum string myMangledName = Dummy!(sth[0]).Hook.mangleof; version(A) { pragma(msg, "1[", Dummy!().Hook.mangleof, "]"); pragma(msg, "2[", Dummy!(sth).Hook.mangleof, "]"); } version(B) { pragma(msg, "2[", Dummy!(sth).Hook.mangleof, "]"); pragma(msg, "1[", Dummy!().Hook.mangleof, "]"); } } class Temp { int Field; pragma(msg, "IGNORE THIS... ", myMangledName!(Field)); } output: c:\d> dmd -version=A -run test.d IGNORE THIS... 1[S4test10__T5DummyZ4Hook] 2[S4test4Temp32__T5DummyS19_D4test4Temp5FieldiZ4Hook] S4test4Temp32__T5DummyS19_D4test4Temp5FieldiZ4Hook c:\d> dmd -version=B -run test.d IGNORE THIS... 2[S4test4Temp32__T5DummyS19_D4test4Temp5FieldiZ4Hook] 1[S4test10__T5DummyZ4Hook] S4test4Temp32__T5DummyS19_D4test4Temp5FieldiZ4Hook -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 01 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5394 --- Comment #2 from wfunction hotmail.com 2012-06-01 17:50:55 PDT --- Sorry, could you please explain how/why you say that is not a bug? o.O -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 01 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5394 --- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2012-06-01 21:25:08 PDT --- (In reply to comment #2)Sorry, could you please explain how/why you say that is not a bug? o.OSee the output of my code. In both version(A) and version(B), pragma(msg, "1[", Dummy!().Hook.mangleof, "]"); prints "1[S4test10__T5DummyZ4Hook]", and pragma(msg, "2[", Dummy!(sth).Hook.mangleof, "]"); prints "2[S4test4Temp32__T5DummyS19_D4test4Temp5FieldiZ4Hook]". It isn't dependent to the order. There is no bug. And, with current dmd implementation, pragma(msg, e1, e2, ...); is interpreted as: eval e1 -> print e1 -> eval e2 -> print e2 -> ... So the printing of pragmas in myMangledName template runs *before* the printing of myMangledName!(Field) result. (I can agree it is compiler implementation dependent behavior, but cannot agree to mark it as a bug.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 01 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5394 --- Comment #4 from wfunction hotmail.com 2012-06-01 21:40:42 PDT --- Oh lol. What version of DMD are you on? Probably just got fixed lol, since they didn't have the same output when I checked. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 01 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5394 --- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2012-06-01 21:46:31 PDT --- I'm using 2.060head. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 01 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5394 --- Comment #6 from wfunction hotmail.com 2012-06-01 22:18:22 PDT --- That's probably why lol. Thanks for posting. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 01 2012