[Issue 11915] Inconsistent overload resolution behaviour between `ref` and `out`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 13 10:25:46 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11915


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #3 from Maxim Fomin <maxim at maxim-fomin.ru> 2014-01-13 10:25:43 PST ---
(In reply to comment #1)
> (In reply to comment #0)
> > This code illustrates the inconsistency:
> > ---
> > void f(int) { }
> > void f(ref int) { }
> > 
> > void g(int) { }
> > void g(out int) { }
> > 
> > void main()
> > {
> >     const int n = 1;
> >     f(n); // ok, selects `void f(int)`
> >     g(n); // Error: constant 1 is not an lvalue
> > }
> > ---
> > 
> > This is either "accepts-invalid" or "rejects-valid" bug.
> > 
> > 
> > The issue is segregated from Issue 11857.
> 
> This is diagnostic bug. With g(n) case, it should provide more better error
> message, like:
> 
> Error: out paraemter does not match non-mutable lvalue 'n' of type 'const int'

Why? Either both should be rejected because lvalue arguements are unsuccessfuly
matched to lvalue parameters, or should be both matched to (int) version
because compiler is not stupid to do what is described above.

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


More information about the Digitalmars-d-bugs mailing list