www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1609] New: TypeInfo_Typedef has incorrect implementation of next()

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1609

           Summary: TypeInfo_Typedef has incorrect implementation of next()
           Product: D
           Version: 1.022
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: tomas famolsen.dk


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.


-- 
Oct 23 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1609






oups forgot something. the test case is:

typedef int int_t;
assert(typeid(int_t).next is typeid(int));


-- 
Oct 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1609


tomas famolsen.dk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |trivial





again so trivial, yet fixing has taken almost a year and has still not
happened.


-- 
Jul 11 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1609


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID





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.


-- 
Jan 06 2009