From 3d1175e821b9c82e45b89f5f49777b1bec115596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Tue, 18 Jul 2017 23:24:54 +0200 Subject: [PATCH] Fix InterfaceProxy when used with class instances. --- source/vibe/internal/interfaceproxy.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/vibe/internal/interfaceproxy.d b/source/vibe/internal/interfaceproxy.d index e98cf7c..5e1216b 100644 --- a/source/vibe/internal/interfaceproxy.d +++ b/source/vibe/internal/interfaceproxy.d @@ -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()); }