Thread overview
[Issue 3091] New: "auto x = new shared foo" does not compile
Oct 28, 2009
Sobirari Muhomori
Oct 28, 2009
Walter Bright
Dec 12, 2011
Kenji Hara
Dec 12, 2011
Kenji Hara
Dec 12, 2011
Jason House
Dec 12, 2011
Kenji Hara
Sep 25, 2012
Kenji Hara
Dec 06, 2012
Kenji Hara
June 24, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3091

           Summary: "auto x = new shared foo" does not compile
           Product: D
           Version: 2.030
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: jason.james.house@gmail.com


Created an attachment (id=402)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=402)
File demonstrating the issue

Attached is a simple test case that I think should compile.  It seems that
shared foo must be replaced with shared(foo).  It's certainly easier to type in
the way I'm hoping for.  Things get a bit ridiculous when templates are
involved auto x = new shared(foo!(bar, baz))(alpha, beta);  Anything that can
be done to reduce the parenthesis is nice.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 28, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3091


Sobirari Muhomori <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor


--- Comment #1 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2009-10-28 10:02:46 PDT ---
Seems like an RFE. Try to compile this:
---
class A{}

int main()
{
    const a = new const A();
    const a = new immutable A();
    return 0;
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 28, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3091


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           Severity|minor                       |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3091



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-12 04:07:44 PST ---
NewExp and StructLiteralExp have this issue.

inout(int) test3091(inout(int) _dummy = 0)
{
    struct Foo {}

    auto  pm = new Foo;
    auto  pc = new const Foo;
    auto  pw = new inout Foo;
    auto psm = new shared Foo;
    auto psc = new shared const Foo;
    auto psw = new shared inout Foo;
    auto  pi = new immutable Foo;

    auto  m = Foo();
    auto  c = const Foo();
    auto  w = inout Foo();
    auto sm = shared Foo();
    auto sc = shared const Foo();
    auto sw = shared inout Foo();
    auto  i = immutable Foo();

    return 0;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3091


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-12 04:27:19 PST ---
https://github.com/D-Programming-Language/dmd/pull/556

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3091



--- Comment #4 from Jason House <jason.james.house@gmail.com> 2011-12-12 05:13:23 PST ---
With that patch, when will "new shared foo()" be allowed? Is it semantically
equivalent to "cast(shared) new foo()"?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3091



--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-12 05:33:41 PST ---
(In reply to comment #4)
> With that patch, when will "new shared foo()" be allowed? Is it semantically
> equivalent to "cast(shared) new foo()"?

"new shared foo()" is allowed, and it is semantically equivalent to "new
shared(foo)()", not cast.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3091



--- Comment #6 from github-bugzilla@puremagic.com 2012-09-25 01:28:44 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/77a617330302166c334f7760fb02e57032d08d21 Issue 3091 - "auto x = new shared foo" does not compile

https://github.com/D-Programming-Language/dmd/commit/ec3e3300949b5aef30c7a71a0287a77135739144 Merge pull request #556 from 9rnsr/fix3091

Issue 3091 & 6873 - Make "StorageClasses Type" syntax available in some where

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3091



--- Comment #7 from Kenji Hara <k.hara.pg@gmail.com> 2012-09-25 06:44:15 PDT ---
Fix for language reference: https://github.com/D-Programming-Language/d-programming-language.org/issues/159

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 06, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3091


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

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


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