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

spir denis.spir at gmail.com
Sun Nov 7 04:52:32 PST 2010


Hello,


class C {int i;}
void main () {
    auto c = 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 more appropriate message? (Or maybe add a hint in parens? "(Did you try to initialise a class instance without 'new'?)")

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


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list