[Issue 373] New: Spec problems with TypeInfo: error and omission.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 26 09:57:03 PDT 2006


http://d.puremagic.com/issues/show_bug.cgi?id=373

           Summary: Spec problems with TypeInfo: error and omission.
           Product: D
           Version: 0.167
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: spec
          Severity: major
          Priority: P1
         Component: www.digitalmars.com
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: brunodomedeiros+bugz at gmail.com


In Functions (http://www.digitalmars.com/d/function.html), Variadic Functions
With Type Info, there is an example of a variadic function, but there is an
error in the FOO clause:

  else if (_arguments[i] == typeid(FOO))
  {
    FOO f = *cast(FOO*)_argptr;
    ...

This if clause will match not only FOO (should be called 'Foo' for style
consistency, btw), but any kind of class and interface, since apparently
TypeInfo's equality('==') operator tests for equality of "archetype", and all
classes and even interfaces are all part of the same archetype (class).

Additionally, this TypeInfo comparison behavior was all inferred empirically:
there is nowhere (AFAIK) in the spec that explains how TypeInfo's are to be
compared, and consequently what are the effects of 'is' and '==' comparisons.
(Please fix this as well.)


-- 




More information about the Digitalmars-d-bugs mailing list