Bug 10484 – [2.064alpha]8635:postfix expressions for new without parameter

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-26T20:30:00Z
Last change time
2013-06-27T03:18:13Z
Keywords
rejects-valid
Assigned to
nobody
Creator
kekeniro2
Depends on
8635

Comments

Comment #0 by kekeniro2 — 2013-06-26T20:30:25Z
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#PrimaryExpression http://dlang.org/expression#NewExpressionWithArgs In the last line, `new Object` does not match NewExpressionWithArgs.