[Issue 3581] New: "private" attribute breaks "override"
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Dec 5 23:01:54 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3581
Summary: "private" attribute breaks "override"
Product: D
Version: 1.051
Platform: Other
OS/Version: All
Status: NEW
Keywords: accepts-invalid, wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: nfxjfg at gmail.com
--- Comment #0 from nfxjfg at gmail.com 2009-12-05 23:01:54 PST ---
The compiler should error on the following code. Even though "override" is
specified, nothing is overridden.
This should either run fine (without triggering the assertion), or not compile.
The first if "override" disregards the current visibility attribute of the
scope, and the second if "foo" is considered a private and thus non-virtual
function. (I do not know which one, so I tagged the bug with both keywords;
please remove this when it's known what should happen.)
Code:
abstract class A {
void foo() {
assert(false); //B.foo should be called instead!
}
}
class B : A {
private: //if you comment this out, it works
void something() {
}
override void foo() {
//never called, which is a bug
}
}
void main() {
A x = new B();
x.foo();
}
--
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