Comment #0 by cristiancreteanu06 — 2020-06-20T15:13:14Z
extern (C++) class A
{
__gshared void function() func;
}
__gshared extern (C++) void function() anotherFunc;
void foo(T)(T bar)
{
A.func = function void() {};
anotherFunc = function void() {};
}
void main()
{
int[] arr;
foo(arr);
}
The code above fails with the following error:
Error: Internal Compiler Error: type int[] cannot be mapped to C++
It acts as if the argument, which was evaluated to a D array, was passed inside the function assigned to the pointer declared as extern(C++), which is not the case. The error does not occur if I change the foo function by removing the template parameter and defining it as follows:
void foo(int[] bar)
{
A.func = function void() {};
anotherFunc = function void() {};
}
Comment #1 by robert.schadek — 2024-12-13T19:09:32Z