Comment #0 by jason.james.house — 2009-06-23T20:46:21Z
Created attachment 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.
Comment #1 by dfj1esp02 — 2009-10-28T10:02:46Z
Seems like an RFE. Try to compile this:
---
class A{}
int main()
{
const a = new const A();
const a = new immutable A();
return 0;
}
---
Comment #2 by k.hara.pg — 2011-12-12T04:07:44Z
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;
}
Comment #4 by jason.james.house — 2011-12-12T05:13:23Z
With that patch, when will "new shared foo()" be allowed? Is it semantically equivalent to "cast(shared) new foo()"?
Comment #5 by k.hara.pg — 2011-12-12T05:33:41Z
(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.
Comment #6 by github-bugzilla — 2012-09-25T01:28:44Z