www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4843] New: Inconsistency in overloading ref vs. non-ref

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4843

           Summary: Inconsistency in overloading ref vs. non-ref
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha yahoo.com> 2010-09-09 06:03:33 PDT ---
The following code compiles and correctly resolves the lvalue vs. non-lvalue
overloading:

import std.stdio;

void doStuff(const ref int i) {
    writeln("Doing stuff by ref.");
}

void doStuff(const int i) {
    writeln("Forwarding to ref overload.");
    doStuff(i);
}

void main() {
    doStuff(1);
} 

Similar code also works for classes and arrays.  It seems to be broken for
structs, though.  The following code is rejected:

import std.stdio;

struct S {}

bool fun(const ref S rhs) {
    return true;
}

bool fun(const S rhs) {
    return fun(rhs);
}

test9.d(12): Error: function test9.fun called with argument types:
    ((const(S)))
matches both:
    test9.fun(ref const const(S) rhs)
and:
    test9.fun(const const(S) rhs)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 09 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4843


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cristi.cobzarenco gmail.com


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-06-24 04:48:56 PDT ---
*** Issue 6201 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4843


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg gmail.com
         Depends on|                            |5889


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2011-06-24 04:54:00 PDT ---
This issue is part of bug5889. Add 'Depends on'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4843


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jens.k.mueller gmx.de


--- Comment #3 from yebblies <yebblies gmail.com> 2012-02-01 02:46:56 EST ---
*** Issue 7409 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 31 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4843


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com


--- Comment #4 from SomeDude <lovelydear mailmetrash.com> 2012-04-20 09:10:43
PDT ---
Compiles on 2.059 Win32

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 20 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4843



--- Comment #5 from jens.k.mueller gmx.de 2012-04-22 13:30:29 PDT ---
Indeed. The issue seems to be fixed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 22 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4843


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #6 from Kenji Hara <k.hara.pg gmail.com> 2012-04-22 16:38:58 PDT ---
*** This issue has been marked as a duplicate of issue 5889 ***

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