[Issue 20427] New: Bad parameter types in C++ functions should not issue Internal Compiler Errors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 3 03:42:49 UTC 2019


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 at puremagic.com
          Reporter: andrej.mitrovich at 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.

--


More information about the Digitalmars-d-bugs mailing list