is Expression, Type Identifier : TypeSpecialization

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Jun 24 06:33:00 PDT 2010


Trass3r Wrote:

> >     class one { }
> >     class two : one {  }
> >    alias one ONE;
> >     alias two TWO;
> >    static if ( is(TWO T : ONE) )
> >         writeln("test");
> >
> > Is this a bug, or am I doing it wrong?
> 
> If it works without the aliases this is another strange alias bug.

Do you mean the "alias one ONE; alias two TWO;" statements, or the missing T alias? In the first case, If I comment out the two alias statements, it will still compile. But that's not a bug, it's still syntactically correct (in that case "ONE" and "TWO" don't exist, but the compiler won't complain about it).

In the second case, the aliased identifier doesn't need to be there unless we want to use it, see form #2 of the is expressions near the bottom of the page:
http://www.digitalmars.com/d/2.0/expression.html


More information about the Digitalmars-d mailing list