[Issue 15141] New: Object.factory allows the creation of derived abstract classes
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Oct 3 04:15:11 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15141
Issue ID: 15141
Summary: Object.factory allows the creation of derived abstract
classes
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: atila.neves at gmail.com
Object.factory returns null for abstract classes, unless they're a child class.
Trying to use this class and calling .method on it causes a crash.
The second assertion fails, it shouldn't:
module factory_test;
class Abstract {
abstract void method();
}
class Middle: Abstract { }
void main() {
auto abs = Object.factory("factory_test.Abtract");
assert(abs is null);
auto mid = Object.factory("factory_test.Middle");
assert(mid is null); //oops
//auto mid2 = new Middle; //doesn't compile
}
--
More information about the Digitalmars-d-bugs
mailing list