void main() {
auto a1 = (new Object()).toString; // OK
auto a2 = (new Object).toString; // OK
auto b1 = new Object().toString; // 2.064 OK
auto b2 = new Object.toString; // error
}
Enhance 8635 allows b1.
So I think b2 should also be allowed.
Comment #1 by andrej.mitrovich — 2013-06-26T20:37:46Z
I don't think it's possible without creating problems:
-----
class C
{
static class D
{
static int opCall() { return 0; }
}
}
void main()
{
int i = new C().D(); // instance of C + D's static opCall
Object d = new C.D(); // instance of D
}
-----
The last line is the problematic one.
Comment #2 by k.hara.pg — 2013-06-27T03:18:13Z
(In reply to comment #0)
> void main() {
> auto a1 = (new Object()).toString; // OK
> auto a2 = (new Object).toString; // OK
>
> auto b1 = new Object().toString; // 2.064 OK
> auto b2 = new Object.toString; // error
> }
>
> Enhance 8635 allows b1.
> So I think b2 should also be allowed.
Enhance 8635 does not support it.
http://dlang.org/expression#PrimaryExpressionhttp://dlang.org/expression#NewExpressionWithArgs
In the last line, `new Object` does not match NewExpressionWithArgs.