www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20427] New: Bad parameter types in C++ functions should not

https://issues.dlang.org/show_bug.cgi?id=20427

          Issue ID: 20427
           Summary: Bad parameter types in C++ functions should not issue
                    Internal Compiler Errors
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andrej.mitrovich gmail.com

```
extern(C++) void test(ubyte[]) {}

void main()
{
}
```

test.d(1): Error: Internal Compiler Error: type `ubyte[]` can not be mapped to
C++

As far as I recall, the user should never see ICEs. The above should just be a
regular error message.

In addition to this, it doesn't work great with templates. For example:

```
extern(C++) void test(T)(T) {}

void main()
{
    test([1, 2]);
}
```

 test.d(1): Error: Internal Compiler Error: type `int[]` can not be mapped to
C++
The error doesn't show the instantiation line test.d(5), making it hard to track down where the bad instantiation comes from. --
Dec 02 2019