www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - missing "new" --> Error: "no property 'opCall'..."


class C {int i;}
void main () {
    auto c =3D C(i);
__trials__.d(31): Error: no property 'opCall' for type '__trials__.C'

Is there a way for the compiler to detect the missing "new" and write a mor=
e appropriate message? (Or maybe add a hint in parens? "(Did you try to ini=
tialise a class instance without 'new'?)")

Also: would it be sensible to make the default opCall for classes precisely=
 instance creation? What do you think?

-- -- -- -- -- -- --
vit esse estrany =E2=98=A3

Nov 07 2010