[Issue 16772] ICE when using extern(C++) and ubyte[] return value
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Nov 28 10:14:24 PST 2016
https://issues.dlang.org/show_bug.cgi?id=16772
Sprink <sprink.noreply at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sprink.noreply at gmail.com
--- Comment #1 from Sprink <sprink.noreply at gmail.com> ---
(In reply to Atila Neves from comment #0)
> extern(C++) ubyte[] foo() { return []; }
>
> dmd foo.d:
>
> Error: Internal Compiler Error: unsupported type ubyte[]
There is no equivalent C++ type that can be represented by "ubyte[]". In D an
array consists of a pointer and a size. In C++ an array is essentially just a
pointer.
This code will result in a compiler error in C++, as the two functions have the
same signature.
void foo(int* in)
{
}
void foo(int in[])
{
}
Use a pointer if you want the function to be extern(C++)
extern(C++) ubyte* foo() { return null; }
--
More information about the Digitalmars-d-bugs
mailing list