January 30, 2004 [Bug] Error using error in constructor | ||||
---|---|---|---|---|
| ||||
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; } |
January 30, 2004 Re: [Bug] Error using property in constructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Down | 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; >} > > |
Copyright © 1999-2021 by the D Language Foundation