Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #351 (new defect)

Opened 3 years ago

Last modified 3 years ago

"Error: incompatible types" although types are the same

Reported by: winterwar Assigned to: lindquist
Priority: major Milestone:
Component: frontend (D1 only) Version: hg tip
Keywords: Cc:

Description

The following program gives the error "xt.d(14): Error: incompatible types for ((&toString) is (&toString)): 'char[] function()' and 'char[] function()'"

class X {

char[] toString() {

return "";

}

}

bool foo;

void main() {

char[] function() f = &X.toString; char[] function() g = &Object.toString; foo = f is g; //following line doesn't work foo = &X.toString is &Object.toString; //line 14

} <<<

But as you can see from the code above line 14, the types definitely are the same.

Change History

08/10/09 00:30:43 changed by winterwar

Looks like the ticket system removed some newlines, which destroyed formatting of the code sample. Here is it again:

class X {
    char[] toString() {
        return "";
    }
}

bool foo;

void main() {
    char[] function() f = &X.toString;
    char[] function() g = &Object.toString;
    foo = f is g;
    //following line doesn't work
    foo = &X.toString is &Object.toString; //line 14
}
Copyright © 2008, LDC Development Team.