[Issue 1462] Templated constructor not supported

Denis Koroskin 2korden at gmail.com
Tue Sep 9 12:51:55 PDT 2008


On Tue, 09 Sep 2008 22:48:01 +0400, Jarrett Billingsley  
<jarrett.billingsley at gmail.com> wrote:

> On Tue, Sep 9, 2008 at 1:32 PM,  <d-bugmail at puremagic.com> wrote:
>> http://d.puremagic.com/issues/show_bug.cgi?id=1462
>>
>>
>> smjg at iname.com changed:
>>
>>           What    |Removed                     |Added
>> ----------------------------------------------------------------------------
>>                 CC|                            |smjg at iname.com
>>           Severity|normal                      |enhancement
>>           Keywords|                            |spec
>>
>>
>>
>>
>> ------- Comment #1 from smjg at iname.com  2008-09-09 12:32 -------
>> The problem seems to be that the current D syntax doesn't support it:
>>
>> Constructor:
>>        this Parameters FunctionBody
>>
>> Parameters:
>>        ( ParameterList )
>>        ( )
>>
>> The alternative would be
>>
>> class Foo
>> {
>>    template(T...) this {
>>        this(T t) {}
>>    }
>> }
>>
>> except that this doesn't work because 'this' is a keyword, not an  
>> identifier.
>>
>>
>> --
>>
>>
>
> I think it's much more that templated methods cannot be virtual, and
> constructors more or less have to be.

How about struct constructors?


More information about the Digitalmars-d-bugs mailing list