Fix InterfaceProxy when used with class instances.

This commit is contained in:
Sönke Ludwig 2017-07-18 23:24:54 +02:00
parent d7b2173cb3
commit 3d1175e821
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -131,7 +131,9 @@ struct InterfaceProxy(I) if (is(I == interface)) {
import std.conv : emplace;
clear();
m_intf = ProxyImpl!O.get();
emplace!O(m_value[0 .. O.sizeof]);
if (is(O == class))
(cast(O[])m_value[0 .. O.sizeof])[0] = object;
else emplace!O(m_value[0 .. O.sizeof]);
(cast(O[])m_value[0 .. O.sizeof])[0] = object;
}
@ -163,7 +165,7 @@ struct InterfaceProxy(I) if (is(I == interface)) {
}
return ret;
}
mixin(impl());
}