[Issue 13068] New: std.typecons.Unique should disable postblit

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 7 06:46:20 PDT 2014


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 at puremagic.com
          Reporter: ntrel-public at 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.

--


More information about the Digitalmars-d-bugs mailing list