Merge pull request #234 from vibe-d/deprecation_fix

Avoid instantiating emplace(O) for class instances
This commit is contained in:
Sönke Ludwig 2020-11-14 19:31:04 +01:00 committed by GitHub
commit a170973cfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -163,7 +163,7 @@ struct InterfaceProxy(I) if (is(I == interface)) {
import std.conv : emplace;
clear();
m_intf = ProxyImpl!O.get();
if (is(O == class))
static if (is(O == class))
(cast(O[])m_value[0 .. O.sizeof/m_value[0].sizeof])[0] = object;
else emplace!O(m_value[0 .. O.sizeof/m_value[0].sizeof]);
swap((cast(O[])m_value[0 .. O.sizeof/m_value[0].sizeof])[0], object);