May 20, 2017 [Issue 17415] New: std.conv.emplace does not forward arguments correctly | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17415 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; emplace!C(S.init); 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. -- |
Copyright © 1999-2021 by the D Language Foundation