[Issue 2328] New: setTypeInfo in gc.d backwards.

Sean Kelly sean at invisibleduck.org
Tue Sep 2 14:30:13 PDT 2008


dsimcha wrote:
>>>
>>> The if statement in this code is clearly backwards.
>> I'm fairly certain that the doc comment is simply wrong.  Last time I
>> checked, the flag was 1 for "has no pointers" as per the implementation.
>>   I'd actually prefer it to work as the comment suggests, however.
> 
> Nope, I actually tested the implementation.  I didn't just assume the doc comment
> was right.  Furthermore, I tried to write code based on the expected behavior of
> Phobos's setTypeInfo() and it was clearly broken.  Lying to setTypeInfo() about
> the type fixed it.  Note that I don't know if this bug exists in Tango or
> Phobos/D1, only that it does exist in Phobos/D2.

Oops, I was thinking of ClassInfo, which uses "&2" to represent 
"hasNoPointers."  You're right that TypeInfo uses "&1" to represent 
"hasPointers."  A bit confusing, so it doesn't surprise me that 
setTypeInfo is wrong.  However, Phobos' use of this flag in the runtime 
code is actually correct.  See internal/gc/gc.d, for example.  In short, 
setTypeInfo should probably just be deleted, since it's both incorrect 
and unused.


More information about the Digitalmars-d-bugs mailing list