https://issues.dlang.org/show_bug.cgi?id=19759
Issue ID: 19759 Summary: compiler crash when passing static array to function with C++ linkage Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: simon.vanber...@yahoo.de DMD crashes, when I try to pass a static array to an extern(C++) function. The promt asked me to report this crash, so I did, but I am a bit baffled that the error message is fully aware of what went wrong and asks me to use a pointer instead. I don't exactly see how this workaround would help though, since I can't change the function signature because of name-mangling, and if I just pass a pointer to the unchanged function, the type system will of course complain. I think the only way forward right now is to switch to C-linkage, so that function-mangling doesn't happen? That would be pretty annoying, since there are other overloads in the library I am using, and so I would have to provide some wrapper for that. The minimal example reads as follows: -----------------Code---------------------- extern(C++) bool fail(float[4] col); void main(){ float[4] array = [0, 1, 2, 3]; fail(array); } -----------------Code---------------------- ----------Compiler Output------------------ dmd repro.d Error: Internal Compiler Error: unable to pass static array to extern(C++) function. Error: Use pointer instead. --- ERROR: This is a compiler bug. Please report it via https://issues.dlang.org/enter_bug.cgi with, preferably, a reduced, reproducible example and the information below. DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the reduction. --- DMD v2.084.1 predefs DigitalMars Windows CRuntime_DigitalMars CppRuntime_DigitalMars LittleEndian D_Version2 all D_InlineAsm D_InlineAsm_X86 X86 Win32 assert D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binary C:\Program Files\D\dmd2\windows\bin\dmd.exe version v2.084.1 config C:\Program Files\D\dmd2\windows\bin\sc.ini DFLAGS '-IC:\Program Files\D\dmd2\windows\bin\..\..\src\phobos' '-IC:\Program Files\D\dmd2\windows\bin\..\..\src\druntime\import' --- object.Error@(0): Illegal Instruction ---------------- 0x004323EB ----------Compiler Output------------------ --