[dmd-beta] D2 2.058 beta

kenji hara k.hara.pg at gmail.com
Sat Feb 11 05:36:45 PST 2012


2012/2/11 Martin Nowak <dawg at dawgfoto.de>:
> On Sat, 11 Feb 2012 13:13:33 +0100, kenji hara <k.hara.pg at gmail.com> wrote:
>
>> Posted a pull. Walter, please merge it.
>> https://github.com/D-Programming-Language/dmd/pull/709
>>
>> 2012/2/11 Martin Nowak <dawg at dawgfoto.de>:
>>>
>>> While this will solve the current problem, the following code will remain
>>> broken.
>>> The root cause is contradicting preferences for variadic templates
>>> in deduceFunctionTemplateMatch and leastAsSpecialized.
>>>
>>> void foo(V)(in V v)     // A
>>> {
>>> }
>>>
>>> void foo(Args...)(auto ref const Args args)    // B
>>> {
>>>   foo(cast(const(int))args[0]);
>>> }
>>>
>>> void main()
>>> {
>>>   foo(10);
>>> }
>>
>>
>> What is "remain broken"? With my pull, foo(10) calls non variadic
>> version (A) as expected.
>>
> No your fix seems correct.
> B with foo(10) should have been MATCHconst due to const Args.
>
> I thought you would make a change because the inner call passes an lvalue.

In this case, `auto ref` in B is no meaning, because both `in V` and
`auto ref const Args` match to both lvalue and rvalue.

Kenji Hara


More information about the dmd-beta mailing list