int C function

Ellery Newcomer ellery-newcomer at utulsa.edu
Fri Sep 30 17:46:52 PDT 2011


weird error. anyone know what's going on?

[ellery at localhost d]$ cat test.d
extern(C) int puts(const char *s);
class X{
    @property void tt(int function(const char *) xz){
    }
}
void main(){
    X x = new X();
    x.tt = &puts;
}
[ellery at localhost d]$ dmd test
test.d(8): Error: function test.X.tt (int function(const const(char*))
xz) is not callable using argument types (int C function(const
const(char*) s))
test.d(8): Error: cannot implicitly convert expression (& puts) of type
int C function(const const(char*) s) to int function(const const(char*))


More information about the Digitalmars-d-learn mailing list