Why __traits(compile,...) fails here?

Simen Kjaeraas simen.kjaras at gmail.com
Wed Aug 8 09:13:30 PDT 2012


On Wed, 08 Aug 2012 11:13:30 +0200, Timon Gehr <timon.gehr at gmx.ch> wrote:

> Yes, but note that this distinction does not make any sense.
>
> alias int Int; // works
>
> isType!Int // 'Int' is clearly a symbol, yet the instantiation fails.

I'm not sure it is 'clearly' a symbol. To the compiler, there is no
difference between int and your Int - they're just different names for
the exact same thing. Depending on when the translation occurs, it may
not be sensible to think of them as separate.


> alias declarations should just accept built-in types. If someone for
> some obscure reason needs to exclude them, template constraints are
> good enough. There is no reason to make built-in types behave specially
> here.

Agreed.

-- 
Simen


More information about the Digitalmars-d-learn mailing list