Testing for template argument being result of takeExactly

Jonathan M Davis jmdavisProg at gmx.com
Mon Sep 24 01:11:24 PDT 2012


On Monday, September 24, 2012 10:02:54 monarch_dodra wrote:
> Well, it does work...
> 
> struct S
> {
>      @disable this();
> }
> 
> void foo(T)(T i)
>      if ( is(T t))
> {}
> 
> void main()
> {
>      //S s; //Fail
>      S s = void;
>      foo(s); //Works
> }
> 
> I think it makes sense that it works, because "is" doesn't
> actually validate a compile time syntax, rather it is just
> declaring that "t can be used as an instance of T", but it is not
> actually declaring *the variable* "t" itself... Not sure I'm
> explaining myself.
> 
> Or I think that's how it works. I've been on a wrong streak
> lately :/

@disable this; is pretty broken, so I wouldn't really trust it at this point.

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

But it wouldn't surprise if is expressions are supposed to act differently. is 
expressions are arguably too fancy for their own good (well, our good anyway).

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list