https://d.puremagic.com/issues/show_bug.cgi?id=11824
Summary: A stack variable escaping problem in CTFE Phobos code
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from [email protected] 2013-12-26 09:50:35 PST ---
import std.array: array;
import std.range: repeat;
auto r = [1].repeat(1).array;
void main() {}
DMD 2.065alpha gives me:
...\dmd2\src\phobos\std\array.d(45): Error: returning a pointer to a local
stack variable
...\dmd2\src\phobos\std\array.d(49): called from here:
trustedGetAddr(result[i])
...\dmd2\src\phobos\std\array.d(49): called from here:
emplace(trustedGetAddr(result[i]), e)
test.d(3): called from here: array(repeat([1], 1u))
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------