Bug 1609 – TypeInfo_Typedef has incorrect implementation of next()
Status
RESOLVED
Resolution
INVALID
Severity
trivial
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-10-23T18:29:00Z
Last change time
2014-02-24T15:59:58Z
Assigned to
bugzilla
Creator
tomas
Comments
Comment #0 by tomas — 2007-10-23T18:29:15Z
This assertion fails:
assert(typeid(int_t).next is typeid(int));
It should be defined as:
TypeInfo next() { return base; }
Not:
TypeInfo next() { return base.next(); }
.. as it is now.
Comment #1 by tomas — 2007-10-23T18:30:08Z
oups forgot something. the test case is:
typedef int int_t;
assert(typeid(int_t).next is typeid(int));
Comment #2 by tomas — 2008-07-11T13:55:23Z
again so trivial, yet fixing has taken almost a year and has still not happened.
Comment #3 by bugzilla — 2009-01-06T04:13:35Z
This is actually the intended behavior. All the virtual functions for a typedef "see through" any layers of typedefs and work on the base type. This makes code that walks the typeinfo's simpler.
To get the base of a typedef, cast the TypeInfo to a TypeInfo_Typedef, and get the .base.