Deduction regression or improvement?

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 12 00:50:42 PST 2016


On 12.03.2016 08:58, deadalnix wrote:
>>
>>
>> IMO, this *should* compile and infer T == const(SomeStruct) as the
>> common type of a and b.  But I'm not sure whether or not this is a
>> regression.
>>
>>
>> T
>
> More tricky actually.
>
> If T has indirection, then that is the correct answer. If not, the T ==
> SomeStruct.

Actually the documentation currently special-cases pointers and arrays:
"The deduced type parameter for dynamic array and pointer arguments has 
an unqualified head:"

http://dlang.org/spec/template.html#function-templates


More information about the Digitalmars-d mailing list