digitalmars.D.bugs - [Issue 7967] New: Bad code with -inline, mismatching constness and array append
- d-bugmail puremagic.com (56/56) Apr 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7967
- d-bugmail puremagic.com (6/6) Apr 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7967
http://d.puremagic.com/issues/show_bug.cgi?id=7967 Summary: Bad code with -inline, mismatching constness and array append Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: siegelords_abode yahoo.com --- Comment #0 from siegelords_abode yahoo.com 2012-04-22 11:18:02 PDT --- This happens with dmd 2.058 and probably earlier ones too. Compile the following with dmd -inline. Note how the assertions fail when the constness of the arguments to the array append doesn't match: char[] toStr(char[] s) { return s; } const(char)[] toStr(const(char)[] s) { return s; } void main() { { auto str = "abcd"; const(char)[] res; res ~= toStr(str); assert(res == str); // Fine } { auto str = "abcd".dup; char[] res; res ~= toStr(str); assert(res == str); // Fine } { auto str = "abcd"; char[] res; res ~= toStr(str); assert(res == str); // Fail } { auto str = "abcd".dup; const(char)[] res; res ~= toStr(str); assert(res == str); // Fail } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7967 --- Comment #1 from siegelords_abode yahoo.com 2012-04-22 11:27:16 PDT --- I meant 2.059 (although 2.058 probably has it too). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2012