[Issue 10012] [2.063 beta] pure constructors taking POD structs should be allowed for shared/immutable construction

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 4 00:43:07 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10012


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid


--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2013-05-04 00:43:03 PDT ---
(In reply to comment #2)
> Sorry, I was blind while preparing the test case. This is the correct one:
> 
> ---
> struct S { string str; }
> class Test { S _s; this(S s) pure { _s = s; } }
> 
> void main()
> {
>     auto test2 = new shared Test(S());
>     auto test3 = new immutable Test(S());
> }
> ---
> 
> So POD indeed works right, but immutable (and shared) references are seemingly
> disallowed.

This is current dmd implementation limitation. In complex cases dmd cannot
detect that the constructor generates unique object.

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


More information about the Digitalmars-d-bugs mailing list