digitalmars.D.bugs - [Issue 7087] New: Produce compiler diagnostic when escaping slice to local static array
- d-bugmail puremagic.com (35/35) Dec 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=7087
- d-bugmail puremagic.com (12/12) Jul 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7087
http://d.puremagic.com/issues/show_bug.cgi?id=7087 Summary: Produce compiler diagnostic when escaping slice to local static array Product: D Version: unspecified Platform: x86_64 OS/Version: Linux Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: acehreli yahoo.com --- Comment #0 from Ali Cehreli <acehreli yahoo.com> 2011-12-09 15:34:52 PST --- Although both are "escaping reference to local" data, only one of the following functions produces a compilation error. int * ret_elem_ptr() { int[3] a; return &a[0]; // GOOD: compilation ERROR } int[] ret_slice() { int[3] a; return a[]; // BAD: no help } void main() {} It would be nice to receive a compilation error when returning a slice as well. This would catch bugs, because programmers rely on slices' keeping their data alive in most situation. Unfortunately that's not the case here. Ali -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7087 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies gmail.com Resolution| |DUPLICATE --- Comment #1 from yebblies <yebblies gmail.com> 2013-07-28 16:41:54 EST --- *** This issue has been marked as a duplicate of issue 8838 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 27 2013