[Issue 12559] New: Multi operators with template mixins produces an error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 11 04:20:10 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12559

          Issue ID: 12559
           Summary: Multi operators with template mixins produces an error
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: temtaime at gmail.com

mixin template T() {
    S opBinary(string s)(S s) { return S(); }     
}

struct S {
    S opBinary(string s)(S s) if(0) { return S(); }     

    mixin T;
}

void main() {
    S a, b;
    a + b;    
}

Error: incompatible types for ((a) + (b)): 'S' and 'S'

But

struct S {
    S opBinary(string s)(S s) if(0) { return S(); } 
    S opBinary(string s)(S s) { return S(); } 
}

void main() {
    S a, b;
    a + b;    
}

Compiles ok

--


More information about the Digitalmars-d-bugs mailing list