D - [Bug] Error using error in constructor
- Patrick Down <Patrick_member pathlink.com> Jan 29 2004
- Patrick Down <Patrick_member pathlink.com> Jan 29 2004
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
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








Patrick Down <Patrick_member pathlink.com>