[Issue 288] New: type of opEquals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 15 05:16:40 PDT 2006


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

           Summary: type of opEquals
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: thomas-dloop at kuehne.cn


Bruno Medeiros schrieb am 2006-08-14:
> I don't think this test case is correct. You test the type-of a TypeInfo 
> (which is an Object) equality operation vs the type-of an int(which is a 
> primitive type) equality operation. Nothing says that such type-of 
> should be the same (even though I very much think it should).
>
> What I do think is not correct is the following (second line) :
>
> writefln( typeid(typeof(typeid(int) == typeid(char))) );// int
> writefln( typeid(typeof(typeid(int) == typeid(int))) );//bool INCORRECT?
> writefln( typeid(typeof(new Object == new Object)) ); // int
>
> writefln( typeid(typeof(typeid(int) != typeid(char))) ); // bool
> writefln( typeid(typeof(typeid(int) != typeid(int))) );  // bool
> writefln( typeid(typeof(new Object != new Object)) ); // bool

http://www.digitalmars.com/d/expression.html#EqualExpression
#
# Equality expressions compare the two operands for equality (==) or
# inequality (!=). The type of the result is bool.
#

Thus samples 1 and 3 are incorrect.

Sources with issues:
dmd-0.164/src/dmd/typinf.c:341:     *   int function(void*,void*) xopEquals;
dmd-0.164/src/phobos/std/bitarray.d:289:    int opEquals(BitArray a2)
dmd-0.164/src/phobos/std/boxer.d:323:    bool opEquals(Box other)
dmd-0.164/src/phobos/object.d:23:    int opEquals(Object o);
dmd-0.164/src/phobos/object.d:109:    int function(void*,void*) xopEquals;
dmd-0.164/src/phobos/internal/object.d:123:    int opEquals(Object o)
dmd-0.164/src/phobos/internal/object.d:181:    int opEquals(Object o)
dmd-0.164/src/phobos/internal/object.d:570:    int function(void*,void*)
xopEquals;

Added to DStress as
http://dstress.kuehne.cn/run/o/opEquals_05_A.d
http://dstress.kuehne.cn/run/o/opEquals_05_B.d
http://dstress.kuehne.cn/run/o/opEquals_05_C.d
http://dstress.kuehne.cn/run/o/opEquals_05_D.d
http://dstress.kuehne.cn/run/o/opEquals_05_E.d
http://dstress.kuehne.cn/run/o/opEquals_05_F.d
http://dstress.kuehne.cn/run/o/opEquals_05_G.d
http://dstress.kuehne.cn/run/o/opEquals_05_H.d


-- 




More information about the Digitalmars-d-bugs mailing list