Bug 3380 – [tdpl] typeid(obj) should return the dynamic type of the object

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-10-08T19:31:00Z
Last change time
2015-06-09T05:15:14Z
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2009-10-08T19:31:52Z
class A {} class B : A {} void main() { auto a = new A; writeln(typeid(a)); } Currently typeid only applies to a type and consequently returns static type information. This bug report aims at merging classinfo into TypeInfo_class. We need to therefore have typeid accept values.
Comment #1 by clugdbug — 2009-10-21T03:42:22Z
Bug 3346 seems to be the same as this one. When fixed, bug 3345 can probably be closed as well.
Comment #2 by bugzilla — 2009-11-20T17:57:12Z
I think you meant: auto a = new B;
Comment #3 by andrei — 2009-11-20T19:34:52Z
(In reply to comment #2) > I think you meant: > > auto a = new B; Sorry. I actually meant: A a = new B; meaning that the static type is different from the dynamic type.
Comment #4 by bugzilla — 2009-12-06T00:51:52Z
Fixed dmd 2.037