digitalmars.D.bugs - [Issue 7046] New: CTFE: append null does nothing
- d-bugmail puremagic.com (29/29) Dec 01 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
- d-bugmail puremagic.com (10/10) Dec 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
- d-bugmail puremagic.com (19/19) Dec 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
- d-bugmail puremagic.com (6/6) Dec 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
- d-bugmail puremagic.com (11/13) Dec 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
- d-bugmail puremagic.com (10/11) Dec 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
- d-bugmail puremagic.com (18/21) Dec 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
- d-bugmail puremagic.com (10/10) Dec 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
- d-bugmail puremagic.com (13/13) Dec 14 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7046
http://d.puremagic.com/issues/show_bug.cgi?id=7046 Summary: CTFE: append null does nothing Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: destructionator gmail.com 18:07:38 PST --- string[] test() { string[] ret; ret ~= null; ret ~= null; assert(ret.length == 2); // fails return ret; } void main() { enum ctfe = test(); } === test90.d(7): Error: assert(ret.length == 2u) failed test90.d(12): called from here: a() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7046 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au This works on git HEAD. Probably a duplicate of a recently fixed bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7046 Steven Schveighoffer <schveiguy yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schveiguy yahoo.com 04:30:34 PST --- Are we sure this isn't expected? I mean a null could mean a null string[], not a null string. string[] ret; string[] a = null; ret ~= a; ret ~= a; neither of these lines should do anything to ret, since they are empty arrays of the same type. I almost think the code in question should fail to compile for being too ambiguous. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7046 See bug 2006. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7046 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.ccI almost think the code in question should fail to compile for being too ambiguous.Right. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7046 04:54:29 PST ---See bug 2006.So is this a dupe? I'm concerned there was a change in git that makes this "work." Moving from one ambiguous interpretation to another doesn't sound like progress. Do we have some definitive answer on what *should* happen? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7046 07:47:17 PST ---I mean a null could mean a null string[], not a null string.I oversimplified the test - in the original code it came from, it was more like string a = null; ret ~= a; which gets the same result in 2.056 I haven't tried git though. I'm not sure how to use that yet!I almost think the code in question should fail to compile for being too ambiguous.With null itself... maybe. In the case of string[], ~= null could have two meanings, but one of them is pretty obviously a no-op, so it's probably not what you meant. If a variable happens to be null, maybe doing nothing is what you wanted, but in that case, the variable has an exact type declared so it's not ambiguous anymore. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7046 07:53:36 PST --- BTW, I labeled this as CTFE because in 2.056, running the same function at runtime, the assert passes. I think this worked in CTFE a couple releases ago too, and since it works in the git version again, it was probably just a temporary regression in the interpreter. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7046 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE This compiled on DMD2.053, but generated wrong code. It failed to compile on 2.054 to 2.056. Fixed 2.057 -- dup of bug 6077 *** This issue has been marked as a duplicate of issue 6077 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 14 2011