[Issue 10789] New: Struct destructor erroneously called

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 9 22:54:27 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10789

           Summary: Struct destructor erroneously called
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: sludwig at outerproduct.org


--- Comment #0 from Sönke Ludwig <sludwig at outerproduct.org> 2013-08-09 22:54:25 PDT ---
The attached program simulates a simple reference counted struct. 'fun' is
supposed to return a newly initialized S with a count of 1. Instead it calls
the destructor dropping the count to zero and then returns a copy of the
initialized struct. Leaving out the 'if' statment and returning the fresh 'S'
directly does not exibit this behavior.

This issue is critical as it has a high probability to indroduce hard to
detect/track down bugs when automatic reference counting is used.

Tested on DMD 2.063.2/Win32 and /Win64 and DMD master/Win32.

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


More information about the Digitalmars-d-bugs mailing list