Thread overview
[Issue 10484] New: [2.064alpha]8635:postfix expressions for new without parameter
Jun 27, 2013
Andrej Mitrovic
Jun 27, 2013
Kenji Hara
June 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10484

           Summary: [2.064alpha]8635:postfix expressions for new without
                    parameter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: kekeniro2@yahoo.co.jp
        Depends on: 8635


--- Comment #0 from kekeniro2@yahoo.co.jp 2013-06-26 20:30:25 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10484


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-26 20:37:46 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10484


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-06-27 03:18:13 PDT ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------