[Issue 3566] New: scoped class's member available after delete

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 2 09:47:57 PST 2009


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

           Summary: scoped class's member available after delete
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: garick_home_333 at rambler.ru


--- Comment #0 from garick <garick_home_333 at rambler.ru> 2009-12-02 09:47:56 PST ---
----------
code:

import std.stdio;

class A 
{ 
    int v_; 

    this( int v ) { v_ = v; }
    ~this() { writeln( "dtor called: ", v_ ); }
}

void f()
{
    scope A a = new A( 4 );
    delete a;
    if( a is null )
        writeln( ">>> a4 is null" );

    a.v_ = 500;
    writeln( "a.v_ == ", a.v_ );
}

void main()
{
    f(); 
    writeln( "end main" );
}

----------
output:

dtor called: 4
a.v_ == 500
end main

"a" must be null after delete..
is this behavior correct ?

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