Bug 20962 – Template parameter evaluating to D style array prevents implicit conversion of function literal to extern(C++)

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-06-20T15:13:14Z
Last change time
2024-12-13T19:09:32Z
Assigned to
No Owner
Creator
Cristian Creteanu
Moved to GitHub: dmd#17965 →

Comments

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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17965 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB