Code:
----------------------------------
auto HookVFunc(T)(T)
{
extern(C++) class Delegate
{
void dd() {}
}
}
class SamplePlugin
{
void Load()
{
HookVFunc(&GameFrame);
}
void GameFrame()
{
}
}
----------------------------------
Error:
source/app.d(5,14): Error: Internal Compiler Error: type `void delegate()` cannot be mapped to C++
----------------------------------
I'm not very sure if this is supposed to be a valid code(I think it is.)
Marked as regression, because run.dlang.io indicates compile success up to DMD 2.65.0
Comment #1 by naydef — 2022-09-17T12:40:09Z
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()
{
}
}
Comment #2 by naydef — 2022-09-17T12:41:10Z
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()
{
}
}
Comment #3 by naydef — 2022-09-17T12:43:26Z
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()
{
}
}
Comment #4 by naydef — 2022-09-18T13:53:15Z
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
-----------------------------------------------
Comment #5 by robert.schadek — 2024-12-13T19:24:29Z