[Issue 4136] New: @disable semantics
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 30 17:34:07 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4136
Summary: @disable semantics
Product: D
Version: unspecified
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2010-04-30 17:34:06 PDT ---
This is not yet a bug report, but it can become one.
This is D2 code:
class A {
void foo() {};
}
class B : A {
override @disable void foo() {}
}
class C : B {
override void foo() {};
}
void main() {
A b1 = new B;
b1.foo();
B c1 = new C;
c1.foo(); // Error: function test.B.foo is not callable...
}
It compiles with dmd 2.043 with an error:
test.d(15): Error: function test.B.foo is not callable because it is annotated
with @disable
The b1 is an instance of class B, but the call to foo produces no error. While
c1 is an instance of C, but it generates an error.
I don't understand well the design of @disable, but to be useful and more
meaningful isn't it necessary/better to enforce it (at run-time) on the dynamic
type of an object?
--
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