Possible bug

Steven Schveighoffer schveiguy at yahoo.com
Mon Mar 25 12:40:07 PDT 2013


On Mon, 25 Mar 2013 11:31:17 -0400, Ali Çehreli <acehreli at yahoo.com> wrote:

> This design allows templated constructors:
>
> struct S         // <-- not a template
> {
>      this(T)(T t) // <-- template
>      {
>          // ...
>      }
>
>      // ...
> }
>
> The same in C++...

Templated constructors would not be disallowed if you allowed IFTI on  
templated structs/classes without templated constructors.

When you decompose constructors, they are simply fucntions, and IFTI  
exists on functions.  The same should be allowed for constructors.

There is almost no difference between this:

template foo(T){
    void foo(T t) {}
}

and this:

struct foo(T){
    this(T t) {}
}

-Steve


More information about the Digitalmars-d-learn mailing list