typeof(typename) fails silently

Sean Kelly sean at invisibleduck.org
Tue Sep 16 18:58:09 PDT 2008


BCS wrote:
> Reply to Sean,
> 
> 
>> I'm of two minds on this.  The is expression already requires whatever
>> it contains to be a type or there will be a compile-time error, but
>> with the change to typeof we no longer have a bullet-proof way of
>> ensuring that something is a type.  So either we use is(T) and hope T
>> is a type or use is(typeof(T)) and hope T is not a type (because if T
>> is a type then the condition will silently fail).  Neither is ideal,
>> for obvious reasons.
>>
> 
> is(T) || is(typeof(T))

Technically, the tests would have to be reversed, but yeah, that would 
work.  It's just annoying :-)


Sean


More information about the Digitalmars-d-bugs mailing list