[Issue 5859] New: Declaration inside if condition doesn't call destructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 18 20:35:17 PDT 2011


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

           Summary: Declaration inside if condition doesn't call
                    destructor
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-04-18 20:31:44 PDT ---
Test code:
----
import std.stdio;
struct S
{
    ~this(){ writeln("S.dtor"); }
    bool opCast(T:bool)(){ return true; }
}
void main()
{
    if (auto s = S())
    {
        // s.~this is not called.
    }
    else assert(0);
}
----

-- 
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