547 – Accessing a deprecated member variable through an explicit object reference is not caught

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 547 - Accessing a deprecated member variable through an explicit object reference is not caught
Summary: Accessing a deprecated member variable through an explicit object reference i...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords: accepts-invalid
Depends on:
Blocks: 546
Show dependency tree / graph
Reported: 2006年11月17日 14:05 UTC by Stewart Gordon
Modified: 2014年02月15日 13:20 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Stewart Gordon 2006年11月17日 14:05:56 UTC
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.
Comment 1 Walter Bright 2008年07月09日 22:34:47 UTC
Fixed dmd 1.032 and 2.016


AltStyle によって変換されたページ (->オリジナル) /