D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17056 - No filename and line info for wrong extern C++ type
Summary: No filename and line info for wrong extern C++ type
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 minor
Assignee: No Owner
URL:
Keywords: ice
Depends on:
Blocks:
 
Reported: 2017-01-02 19:59 UTC by Dāvis
Modified: 2020-03-21 03:56 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dāvis 2017-01-02 19:59:35 UTC
Compiling D application like:

```
extern (C++) void test(string t) { };
```

will produce error:

```
Error: Internal Compiler Error: unsupported type string
```

And there's no information about which file and line this wrong type definition is in which makes it not easy to find it if there's a lot of files and extern declarations.
Comment 1 Citrus 2017-01-04 12:52:55 UTC
This should be only a matter of using the Loc of the Dsymbol we're currently mangling when an error is thrown.
Comment 2 Jacob Carlborg 2017-01-04 17:22:18 UTC
(In reply to bitter.taste from comment #1)
> This should be only a matter of using the Loc of the Dsymbol we're currently
> mangling when an error is thrown.

I'm pretty sure it's reporting the error as "Internal Compiler Error" because the error should have been caught earlier, properly reported with file and line number.
Comment 3 Jacob Carlborg 2017-01-04 17:23:23 UTC
The mangler shouldn't do the type checking.
Comment 4 Citrus 2017-01-04 20:32:08 UTC
(In reply to Jacob Carlborg from comment #2)
> (In reply to bitter.taste from comment #1)
> > This should be only a matter of using the Loc of the Dsymbol we're currently
> > mangling when an error is thrown.
> 
> I'm pretty sure it's reporting the error as "Internal Compiler Error"
> because the error should have been caught earlier, properly reported with
> file and line number.

Nah, it's just that every error that's thrown from cppmangle.d is prefixed with "Internal Compiler Error" and uses Loc() as loc instead of using the one of the symbol it is trying to mangle.
No type checking is done in the mangler, it's just that there's no C++ type a D `string' maps to, you could effectively prevent the use of types that have no 1:1 mapping to C++ ones but that's another matter, this approach just works (TM).
Comment 5 basile-z 2019-02-28 17:09:55 UTC
Nowadays a good loc is reported and there's no ICE, see

https://run.dlang.io/is/6JhfXs