www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19838] New: RefCounted fails

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

          Issue ID: 19838
           Summary: RefCounted fails
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: marcioapm gmail.com

I am getting this error when compiling with DMD 2.085.1.
It works fine with 2.083.1

Unfortunately I was not able to put together a simple test case.


/usr/include/dmd/phobos/std/typecons.d(6236,24): Error: pure function 
std.typecons.RefCounted!(WrappedConnection!(LockedConnection!(Connection!VibeSocket*)),
cast(RefCountedAutoInitialize)1).RefCounted.RefCountedStore.move cannot call
impure function
std.algorithm.mutation.moveEmplace!(WrappedConnection!(LockedConnection!(Connection!VibeSocket*))).moveEmplace


Looking at the code, it seems this commit broke it:
https://github.com/dlang/phobos/commit/c4324f405c6aea75c9c074c42a21b42a2a361d76#diff-4e008aedb3026d4a84f58323e53bf017

RefCountedStore.move() was made pure nothrow, but there is no guarantee that
std.algorithm.moveEmplace will be so, as I suppose it's pureness is infered and
therefore not always true.

--
Apr 30 2019