www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10623] New: destructor not called for function argument if constructing another argument throws

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10623

           Summary: destructor not called for function argument if
                    constructing another argument throws
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrei erdani.com



PDT ---
Consider:

import std.stdio;

struct S1 { 
    this(int) { writeln("constructed"); } 
    ~this() { writeln("destroyed"); } 
}
struct S2 { this(int) { throw new Exception("a"); } }

void fun(S1, S2, S1) {}

void main()
{
    fun(S1(2), S2(2), S1(2));
}

Running this code will create an object of type S1 that is never destroyed.
This is somewhat related to http://d.puremagic.com/issues/show_bug.cgi?id=9704,
just there's no postblit.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10623


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim maxim-fomin.ru



---
I think this can be marked as a dup because it is a particular situation of
essentially the same case described in issue 9704.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 12 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10623


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |monarchdodra gmail.com
           See Also|                            |http://d.puremagic.com/issu
                   |                            |es/show_bug.cgi?id=9704
         Resolution|                            |DUPLICATE




 I think this can be marked as a dup because it is a particular situation of
 essentially the same case described in issue 9704.
This indeed a more generically worded description, but essentially, the same thing. Also, (since links never hurt), this issue was also discussed recently in learn: http://forum.dlang.org/thread/20130628005448.00000969 unknown?page=2 *** This issue has been marked as a duplicate of issue 9704 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 12 2013