Automatic typing

Steven Schveighoffer schveiguy at yahoo.com
Sun Jun 30 19:01:13 PDT 2013


On Sun, 30 Jun 2013 21:56:21 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:

> The described strategy can easily result in non-termination, and which  
> template instantiations it performs can be non-obvious.
>
> auto foo(T)(T arg){
>      static if(is(T==int)) return 1.0;
>      else return 1;
> }
>
> void main(){
>      auto x;
>      x = 1;
>      x = foo(x);
> }

Ouch!  That is better than Walter's case :)

-Steve


More information about the Digitalmars-d mailing list