www.digitalmars.com         C & C++   DMDScript  

D - [Bug] Error using error in constructor

reply Patrick Down <Patrick_member pathlink.com> writes:
Using a getter property in a contructor causes the
follow compiler error:

C:\Programming\D\bugs\err9>dmd err9.d
err9.d(23): constructor this (char[]b) does not match argument types (char[]())

class Foo
{
char[] prop()
{
return "sdsf";
}
}

class Bar
{
this(char[] b)
{
}
}

int main(char[][] argv)
{
Foo z;

char[] a = z.prop; // ok here

Bar b = new Bar(z.prop); // not here

return 0;
}
Jan 29 2004
parent Patrick Down <Patrick_member pathlink.com> writes:
Whoops. :) I should watch what I write in the title.

In article <bvcjcc$169t$1 digitaldaemon.com>, Patrick Down says...
Using a getter property in a contructor causes the
follow compiler error:

C:\Programming\D\bugs\err9>dmd err9.d
err9.d(23): constructor this (char[]b) does not match argument types (char[]())

class Foo
{
char[] prop()
{
return "sdsf";
}
}

class Bar
{
this(char[] b)
{
}
}

int main(char[][] argv)
{
Foo z;

char[] a = z.prop; // ok here

Bar b = new Bar(z.prop); // not here

return 0;
}

Jan 29 2004