Thread overview
[Issue 4174] New: Template interface functions not allowed
[Issue 4174] Template interface functions not allowed, making operator overloads difficult
Jun 16, 2011
yebblies
Apr 05, 2012
yebblies
Apr 28, 2012
Walter Bright
May 10, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4174

           Summary: Template interface functions not allowed
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: schveiguy@yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-05-10 14:35:10 PDT ---


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4174


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Template interface          |Template interface
                   |functions not allowed       |functions not allowed,
                   |                            |making operator overloads
                   |                            |difficult


--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-05-10 14:41:26 PDT ---
Sorry, enter key added the issue when I was typing the summary.

Operator overloads require template functions, yet this doesn't work:

interface I
{
   I addAssign(I other);
   I opOpAssign(string op)(I other) if (op == "+=")
   {
      return this.addAssign(other);
   }
}

void foo(I i)
{
   i += i;
}

error message:

testinterface.d(4): Error: function
testinterface.I.opOpAssign!("+=").opOpAssign template member functions are not
allowed in interface I
testinterface.d(12): Error: template instance testinterface.I.opOpAssign!("+=")
error instantiating

How shall I implement operators for interfaces?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4174


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4174


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |bugzilla@digitalmars.com


--- Comment #2 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-12-29 12:37:55 PST ---
That should be op == "+". With that change I am getting the same error message. Assigning to Walter to expedite review.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4174



--- Comment #3 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-12-29 12:40:08 PST ---
Yes, I think back in May, you needed "+=".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4174


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, rejects-valid
                 CC|                            |yebblies@gmail.com


--- Comment #4 from yebblies <yebblies@gmail.com> 2011-06-16 00:02:54 PDT ---
https://github.com/D-Programming-Language/dmd/pull/131

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 06, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4174


Alex Rønne Petersen <xtzgzorex@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xtzgzorex@gmail.com


--- Comment #5 from Alex Rønne Petersen <xtzgzorex@gmail.com> 2012-01-06 07:24:17 PST ---
Any news on this? This is still very much a blocker for many designs.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4174


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dawg@dawgfoto.de


--- Comment #6 from yebblies <yebblies@gmail.com> 2012-04-05 10:44:34 EST ---
*** Issue 7816 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: -------
April 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4174



--- Comment #7 from github-bugzilla@puremagic.com 2012-04-27 18:37:45 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bb9200a4f80c912a4b9e4c4649307d86edb0624c
Issue 4174 - Template interface functions not allowed, making operator
overloads difficult

The lifting restriction banning final and static members in interfaces should also apply to template functions.

https://github.com/D-Programming-Language/dmd/commit/f1f09dd8ef3710e631d387268a5cf03507ccf99b Merge pull request #131 from yebblies/issue4174

Issue 4174 - Template interface functions not allowed, making operator overloads difficult

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4174


Walter Bright <bugzilla@digitalmars.com> changed:

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


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