digitalmars.D.bugs - [Issue 560] New: Cannot escape reference to variadic parameter
- d-bugmail puremagic.com (34/34) Nov 18 2006 http://d.puremagic.com/issues/show_bug.cgi?id=560
- d-bugmail puremagic.com (5/5) Nov 18 2006 http://d.puremagic.com/issues/show_bug.cgi?id=560
- d-bugmail puremagic.com (9/9) Dec 03 2006 http://d.puremagic.com/issues/show_bug.cgi?id=560
http://d.puremagic.com/issues/show_bug.cgi?id=560 Summary: Cannot escape reference to variadic parameter Product: D Version: 0.174 Platform: PC URL: http://www.digitalmars.com/d/function.html OS/Version: Windows Status: NEW Keywords: rejects-valid, spec Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: deewiant gmail.com OtherBugsDependingO 511 nThis: The following code is directly from the spec: int test(int i ...) { return i; } void main() { test(3); } The spec claims that "[a]n implementation may construct the object or array instance on the stack. Therefore, it is an error to refer to that instance after the variadic function has returned". This would seem to allow doing this for parameters which aren't object or array instances. Indeed, the spec gives the above code as an example of how "[f]or other types, the argument is built with itself". I'd say DMD is in error here. I've yet to realise how "int test(int i ...)" is any better or different from "int test(int i)", though. --
Nov 18 2006
http://d.puremagic.com/issues/show_bug.cgi?id=560 Of course I forget to explain the bug itself. Currently, DMD errors out with: asdf.d(5): Error: escaping reference to variadic parameter i --
Nov 18 2006
http://d.puremagic.com/issues/show_bug.cgi?id=560 deewiant gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed in DMD 0.176. --
Dec 03 2006