Skip to content

Calling delegate from extern(C++) class crashes on Windows #23570

Description

@tim-dlang
import std.stdio;

extern(C++) class A
{
    ~this(){}
    int i;
}

extern(C++) interface I
{
    void f();
}

extern(C++) class B : A, I
{
    void f()
    {
        writeln("B.f ", i);
    }
}

void main()
{
    scope obj = new B;
    obj.i = 42;
    obj.f(); // Prints 42 as expected
    auto dg = &obj.f;
    dg(); // Crashes on Windows
}

The above program works on Linux, but crashes on Windows while calling dg.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions