www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13068] New: std.typecons.Unique should disable postblit

https://issues.dlang.org/show_bug.cgi?id=13068

          Issue ID: 13068
           Summary: std.typecons.Unique should disable postblit
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: ntrel-public yahoo.co.uk

Unique!int u1 = new int;
    auto u2 = u1; // should be disallowed
    auto u3 = u1.release; // ok

Otherwise u2 and u1 both own the same memory, which will be freed twice.

I'll make a pull request to fix this.

--
Jul 07 2014