www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5551] New: opUnary-opBinary conflict

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

           Summary: opUnary-opBinary conflict
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I think this is correct code (trouble originally found by Charles McAnany):

struct Foo {
    Foo opUnary(string op:"++")() {
        return this;
    }
    Foo opBinary(string op)(int y) {
        return this;
    }
}
void main() {
    auto f = Foo();
    f++;
}


But DMD 2.051 shows the errors:
test.d(11): Error: template test.Foo.opBinary(string op) does not match any
function template declaration
test.d(11): Error: template test.Foo.opBinary(string op) cannot deduce template
function from argument types !()()

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |k.hara.pg gmail.com



Patch create and send pull request:
https://github.com/D-Programming-Language/dmd/pull/50

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



21:31:47 PDT ---
https://github.com/D-Programming-Language/dmd/commit/ea9848b16fad21599b65a6669eef3abb2c3d0fc0

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