[Issue 5893] Allow simple aliases for operator overloading

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 5 17:24:05 PST 2013


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


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

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


--- Comment #6 from Kenji Hara <k.hara.pg at gmail.com> 2013-02-05 17:24:03 PST ---
(In reply to comment #5)
> (In reply to comment #4)
> > Commits pushed to master at https://github.com/D-Programming-Language/dmd
> > 
> > https://github.com/D-Programming-Language/dmd/commit/8bc59cfe8e6896435f20ce1e9bdcc226942f59a8
> > fix Issue 5893 - Allow simple aliases for operator overloading
> > 
> > https://github.com/D-Programming-Language/dmd/commit/2888ec45218e2e49048e9f96be2fa0481dc00e31
> > Merge pull request #989 from 9rnsr/fix5893
> > 
> > Issue 5893 - Allow simple aliases for operator overloading
> 
> The OP sample still fails.

The OP sample cannot compile, because ConcatAssignExp will try to instantiate
opOpAssign!("~"). Correct sample code is:

class C
{
   void concatAssign(C other) { }
   void concatAssign(int other) { } // to demonstrate overloading

   template opOpAssign(string s) if (s == "~")  // FIXED
   { alias concatAssign opOpAssign; }
}
void main()
{
   auto c = new C;
   c.opOpAssign!"~"(c); // works
   c.opOpAssign!"~"(1); // works
   c ~= 1; // line 15
}

So, this bug is already fixed.

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


More information about the Digitalmars-d-bugs mailing list