[Issue 1687] "extern (C++) interface" and vtbl
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 15 21:42:36 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=1687
yebblies <yebblies at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yebblies at gmail.com
--- Comment #5 from yebblies <yebblies at gmail.com> 2013-11-16 16:42:33 EST ---
I'm pretty sure this bug was fixed by
https://github.com/D-Programming-Language/dmd/pull/2441
https://github.com/D-Programming-Language/dmd/pull/2441/files#diff-51c17721512749ee0a457d576c82eb2eR638
This code
=====================
extern (C++) interface A { void foo(); void bar(); }
void main()
{
A a;
a.foo();
}
====================
Generates:
__Dmain PROC NEAR
; COMDEF __Dmain
xor eax, eax ; 0000 _ 31. C0 // a = null
mov ecx, eax ; 0002 _ 89. C1
mov edx, dword ptr [eax] ; 0004 _ 8B. 10 // edx = a.__vptr[0]
call dword ptr [edx] ; 0006 _ FF. 12 // edx()
xor eax, eax ; 0008 _ 31. C0
ret ; 000A _ C3
__Dmain ENDP
ie foo is called from vtbl index 0
(In reply to comment #4)
> This segfaults:
>
> extern (C++) interface A { void foo(); void bar(); }
>
> extern (C++) class B : A { void foo() { } void bar() { } }
>
> void main()
> {
> A a = new B;
> a.foo();
> }
>
> It actually segfaults even without the interface and the call.
It does? What platform? Are you using git head or a release?
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list