www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3566] New: scoped class's member available after delete

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: garick_home_333 rambler.ru


--- Comment #0 from garick <garick_home_333 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: -------
Dec 02 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3566


garick <garick_home_333 rambler.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major


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