Thread overview
[Issue 23339] Internal Compiler Error with extern(C++) class declared in function template
Sep 17, 2022
naydef
Sep 17, 2022
naydef
Sep 17, 2022
naydef
Sep 18, 2022
naydef
September 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23339

--- Comment #1 from naydef <naydef@abv.bg> ---
Adding 'static' to class Delegate does not change anything(suggested by Adam)

-------------------------------------------------
auto HookVFunc(T)(T)
{
    extern(C++) static class Delegate
    {
        void dd() {}
    }
}


class SamplePlugin
{
    void Load()
    {
        HookVFunc(&GameFrame);
    }

    void GameFrame()
    {
    }
}

--
September 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23339

--- Comment #2 from naydef <naydef@abv.bg> ---
Adding 'static' to class Delegate does not change anything(suggested by Adam)

-------------------------------------------------
auto HookVFunc(T)(T)
{
    extern(C++) static class Delegate
    {
        void dd() {}
    }
}


class SamplePlugin
{
    void Load()
    {
        HookVFunc(&GameFrame);
    }

    void GameFrame()
    {
    }
}

--
September 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23339

--- Comment #3 from naydef <naydef@abv.bg> ---
Adding 'static' to class Delegate does not change anything(suggested by Adam)

-------------------------------------------------
auto HookVFunc(T)(T)
{
    extern(C++) static class Delegate
    {
        void dd() {}
    }
}


class SamplePlugin
{
    void Load()
    {
        HookVFunc(&GameFrame);
    }

    void GameFrame()
    {
    }
}

--
September 18, 2022
https://issues.dlang.org/show_bug.cgi?id=23339

--- Comment #4 from naydef <naydef@abv.bg> ---
Sorry for the comment spam

Another example caused by the same issue, probably:
-----------------------------------------------
import std.stdio;
import std.traits;

extern(C++) class Delegate(string Linkage)
{
    void opCall()
    {
        string myString = Linkage;
    }
}

void main()
{
    auto special = new Delegate!("C");
}
-----------------------------------------------
onlineapp.d(14): Error: template instance `onlineapp.Delegate!"C"` Internal Compiler Error: C++ `string` template value parameter is not supported
-----------------------------------------------

--