D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14195 - Ice when mangling templated function parameter extern(C++) function
Summary: Ice when mangling templated function parameter extern(C++) function
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P1 normal
Assignee: No Owner
URL:
Keywords: C++, ice
Depends on:
Blocks:
 
Reported: 2015-02-17 18:38 UTC by Benjamin Thaut
Modified: 2017-07-19 17:38 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Benjamin Thaut 2015-02-17 18:38:28 UTC
struct Delegate1(T) {}
struct Delegate2(T1, T2) {}

template Signature(T)
{
  alias Signature = typeof(*(T.init));
}

alias del1_t = Delegate1!(Signature!(void function()));
alias del2_t = Delegate2!(Signature!(int function(float, double)), Signature!(int function(float, double)));

extern(C++) 
{
  void DelegateTest1(del1_t);
  void DelegateTest2(del2_t);
}

When compiling with the latest dmd from git head on windows this will output:
Error: ICE: Unsupported type void()
Error: ICE: Unsupported type int(float, double)
Error: ICE: Unsupported type int(float, double)

It should mangle the functions as:
static assert(DelegateTest1.mangleof == "?DelegateTest1@@YAXU?$Delegate1@$$A6AXXZ@@@Z");
static assert(DelegateTest2.mangleof == "?DelegateTest2@@YAXU?$Delegate2@$$A6AHMN@Z$$A6AHMN@Z@@@Z");
Comment 2 github-bugzilla 2015-02-20 11:01:34 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c4ef4296e217337de4d4137bae57bfda710454e2
Fixed bug 14195: Added C++ mangling for passing function signatures as template parameters.

https://github.com/D-Programming-Language/dmd/commit/a68e1c1d4a08b029490c0c832920e0fdb12d7093
Merge pull request #4419 from Ingrater/fix14195

Fixed bug 14195: Added C++ mangling for passing function signatures
Comment 3 github-bugzilla 2015-02-21 09:11:48 UTC
Commits pushed to https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c4ef4296e217337de4d4137bae57bfda710454e2
Fixed bug 14195: Added C++ mangling for passing function signatures as template parameters.

https://github.com/D-Programming-Language/dmd/commit/a68e1c1d4a08b029490c0c832920e0fdb12d7093
Merge pull request #4419 from Ingrater/fix14195
Comment 4 github-bugzilla 2015-06-17 21:00:55 UTC
Commits pushed to stable at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c4ef4296e217337de4d4137bae57bfda710454e2
Fixed bug 14195: Added C++ mangling for passing function signatures as template parameters.

https://github.com/D-Programming-Language/dmd/commit/a68e1c1d4a08b029490c0c832920e0fdb12d7093
Merge pull request #4419 from Ingrater/fix14195
Comment 5 github-bugzilla 2017-07-19 17:38:39 UTC
Commits pushed to dmd-cxx at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/c4ef4296e217337de4d4137bae57bfda710454e2
Fixed bug 14195: Added C++ mangling for passing function signatures as template parameters.

https://github.com/dlang/dmd/commit/a68e1c1d4a08b029490c0c832920e0fdb12d7093
Merge pull request #4419 from Ingrater/fix14195