[Issue 1528] [tdpl] overloading template and non-template functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 24 08:37:24 PST 2011


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


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |yebblies at gmail.com
           Platform|x86                         |All
            Summary|[tdpl] templates should not |[tdpl] overloading template
                   |conflict with non-templates |and non-template functions
         OS/Version|Windows                     |All
           Severity|enhancement                 |major


--- Comment #3 from yebblies <yebblies at gmail.com> 2011-12-25 03:37:21 EST ---
>From Andrei's comment in 7134:

This TDPL code does not compile:

class A {
   // Non-overridable method
   A opBinary(string op)(A rhs) {
      // Forward to an overridable function
      return opBinary(op, rhs);
   }
   // Overridable method, dispatch string at runtime
   A opBinary(string op, A rhs) {
      switch (op) {
         case "+":
            break;
         case "-":
            break;
      }
   }
}

Overloading template and non-template functions must be implemented.

-- 
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