[Issue 11824] New: A stack variable escaping problem in CTFE Phobos code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 26 09:50:38 PST 2013


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: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 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: -------


More information about the Digitalmars-d-bugs mailing list