www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12226] New: functions can return local stack-allocated objects by reference

https://d.puremagic.com/issues/show_bug.cgi?id=12226

           Summary: functions can return local stack-allocated objects by
                    reference
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrea.9940 gmail.com


--- Comment #0 from andrea.9940 gmail.com 2014-02-22 12:25:43 PST ---
An auto ref function can return a local stack-allocated struct by reference
causing undefined behavior when executed.

Sample code: http://pastebin.com/rvcNdjAE

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 22 2014