https://issues.dlang.org/show_bug.cgi?id=20468
Issue ID: 20468
Summary: emplace doesn't forward constructor arguments'
(l/r)valueness
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: druntime
Assignee: [email protected]
Reporter: [email protected]
`core.lifetime.emplace` always forwards constructor arguments by ref.
example:
```
import core.lifetime : emplace;
import std.stdio;
struct A {}
struct B
{
this()(auto ref A a)
{
static if (__traits(isRef, a))
writeln("copy");
else
writeln("move");
}
}
void main()
{
B obj = void;
A a;
emplace(&obj, a);
emplace(&obj, A());
}
```
output:
---
copy
copy
---
expected output:
---
copy
move
---
--