← Back to index
|
Original Bugzilla link
Bug 20468 – emplace doesn't forward constructor arguments' (l/r)valueness
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-12-28T02:35:35Z
Last change time
2020-01-08T01:24:21Z
Keywords
pull
Assigned to
No Owner
Creator
Suleyman Sahmi (سليمان السهمي)
Comments
Comment #0
by sahmi.soulaimane — 2019-12-28T02:35:35Z
`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 ---
Comment #1
by dlang-bot — 2020-01-01T19:11:06Z
@SSoulaimane created dlang/druntime pull request #2890 "Fix issue 20468 - `emplace` should forward argument lvalueness correctly" fixing this issue: - Fix issue 20468 - `emplace` should forward argument lvalueness correctly
https://github.com/dlang/druntime/pull/2890
Comment #2
by dlang-bot — 2020-01-08T01:24:21Z
dlang/druntime pull request #2890 "Fix issue 20468 - `emplace` should forward argument lvalueness correctly" was merged into master: - f8b2223c44214c536a759cf8b38cc770d70dd626 by سليمان السهمي (Suleyman Sahmi): Fix issue 20468 - `emplace` should forward argument lvalueness correctly
https://github.com/dlang/druntime/pull/2890