www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10484] New: [2.064alpha]8635:postfix expressions for new without parameter

reply d-bugmail puremagic.com writes:
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



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: -------
Jun 26 2013
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jun 26 2013
prev sibling parent d-bugmail puremagic.com writes:
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




 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: -------
Jun 27 2013