Template not seeming to instantiate a second time with default alias parameter
wobbles via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 30 14:28:02 PDT 2016
On Tuesday, 30 August 2016 at 20:55:20 UTC, ag0aep6g wrote:
> On 08/30/2016 10:41 PM, wobbles wrote:
>> class Node(T, alias func = (T t => t*t))(){
>> //whatever
>> }
>>
>> //instantiate
>> Node!(int) intNode;
>> Node!(float) floatNode; // fails as lambda func expects an
>> int.
>>
>> Am I doing something wrong or is this a bug?
>
> Proper test case:
>
> ----
> class Node(T, alias func = (T t) => t*t)
> {
> void method() { func(T.init); }
> }
>
> //instantiate
> Node!(int) intNode;
> Node!(float) floatNode; // fails as lambda func expects an
> int.
> ----
>
> Looks like a bug to me. Similar to this:
> https://issues.dlang.org/show_bug.cgi?id=14501
Yeah. Looks related.
I'll have to try find a workaround for now :/
More information about the Digitalmars-d-learn
mailing list