Summary: Template this parameters don't work with operator
           Product: D
           Version: 2.036
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Tomasz SowiƄski <> 2010-01-10 15:07:37 
PST ---

class A {
    int a;
    This opAssign(this This)(int a) {
        this.a = a;
        return this;

void main() {
    A aa = new A;
    aa = 4;   // oops!

Error: template test.A.opAssign(this This) does not match any function template
Error: template test.A.opAssign(this This) cannot deduce template function from
argument types !()(int)


The testcase should compile. Problem is that when operator overloads are used,
template this parameters are not inferred. I suspect it's like that for all
operator overloads (I tested only for assign and add, though).

When you call the operator functions explicitly, aa.opAssign(4), it compiles.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to