www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17415] New: std.conv.emplace does not forward arguments


          Issue ID: 17415
           Summary: std.conv.emplace does not forward arguments correctly
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: stanislav.blinov gmail.com

import std.conv : emplace;

struct S
     disable this(this);

class C
    this(S) {}

void[__traits(classInstanceSize, C)] holder = 0;

I'd expect that to compile, and move the initializer correctly. But it does not
compile (static assert), because emplace() copies arguments around, instead of
using something like std.functional.forward. However, the fix is not trivial,
some of the Phobos code actually depends on this, whether intentionally or
accidentally, I cannot tell.

May 20 2017