D issues are now
tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Summary: |
Accessing a deprecated member variable through an explicit object reference is not caught |
Product: |
D
|
Reporter: |
Stewart Gordon <smjg> |
Component: |
dmd | Assignee: |
Walter Bright <bugzilla> |
Status: |
RESOLVED
FIXED
|
Severity: |
normal
|
Keywords: |
accepts-invalid |
Priority: |
P2
|
Version: |
D1 (retired) |
Hardware: |
x86 |
OS: |
Windows |
Issue Depends on: |
Issue Blocks: |
546
|
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