www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 547] New: Accessing a deprecated member variable through an explicit object reference is not caught

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

           Summary: Accessing a deprecated member variable through an
                    explicit object reference is not caught
           Product: D
           Version: 0.174
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: smjg iname.com


The following code accesses the deprecated members of the class in different
ways.  The body of the function test thus contains no legal statement (if
compiling without -d) but nonetheless compiles without error.

----------
import std.stdio;

class ClassWithDeps {
    deprecated int value;
    deprecated static int staticValue;

    void test(ClassWithDeps obj) {
        obj.value = 666;
        obj.staticValue = 102;
        this.value = 666;
        this.staticValue = 103;
        ClassWithDeps.staticValue = 104;
        writefln(obj.value);
        writefln(obj.staticValue);
        writefln(this.value);
        writefln(this.staticValue);
        writefln(ClassWithDeps.staticValue);
    }
}
----------

The same happens if a struct or union is used instead of a class.


-- 
Nov 17 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=547


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed dmd 1.032 and 2.016


-- 
Jul 09 2008