http://d.puremagic.com/issues/show_bug.cgi?id=9410


Maxim Fomin <ma...@maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, rejects-valid
                 CC|                            |ma...@maxim-fomin.ru


--- Comment #1 from Maxim Fomin <ma...@maxim-fomin.ru> 2013-01-27 05:35:11 PST 
---
Reduced (Error: S() is not an lvalue)

import std.stdio;

struct S {}

void foo(float f, ref const S s)
{
    writeln("const");
}

void foo(float f, const S s)
{
    writeln("ref const");
}

void main()
{
    foo(1, S()); // 1f fixes code and calls ref const version
}


If overloaded functions have several parameters, one of which is
const-qualified used-defined type and functions differer only in refness of
that parameter, supplying implicitly convertible arguments (like int to float)
to other parameters breaks compiler. 

Passing 1f results in calling ref const version which contradicts to recent
revertion of passing struct literals by ref (however that was without const).
It is unclear what should happen in presence of const.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to