digitalmars.D - C++ function signature template parameter mangling issue
- Benjamin Thaut (24/24) Feb 16 2015 I have a c++ struct:
- Daniel Murphy (6/11) Feb 16 2015 struct X(T) { pragma(msg, X.stringof); }
- Benjamin Thaut (3/8) Feb 16 2015 Error: ICE: Unsupported type void()
- Daniel Murphy (5/7) Feb 16 2015 Good news is that that's a compiler bug and not a language limitation.
- Walter Bright (3/11) Feb 17 2015 True, it might be easier to adjust the C++ side so it takes a pointer to...
- Benjamin Thaut (4/6) Feb 17 2015 In this case it would be really ugly
- Walter Bright (2/13) Feb 17 2015 Please file bugzilla!
- Benjamin Thaut (3/18) Feb 17 2015 https://issues.dlang.org/show_bug.cgi?id=14195
- Walter Bright (2/6) Feb 17 2015 Thank you
I have a c++ struct: template <typename retval> struct ezDelegate<retval ()> { } void DelegateTest(ezDelegate<void ()> func) { ... } And I want to match that on the D side, unfortunately it does not work: D: struct ezDelegate(Signature) {} alias delegate_t = ezDelegate!(void function()); extern(C++) void DelegateTest(delegate func); D mangles ?DelegateTest YAXU?$ezDelegate $$A6AXXZ Z void __cdecl DelegateTest(struct ezDelegate<void (__cdecl*)(void)>) What C++ does: ?DelegateTest YAXU?$ezDelegate P6AXXZ Z void __cdecl DelegateTest(struct ezDelegate<void __cdecl(void)>) I understand that "void function()" is actually a function pointer and thus the mangling is "correct". But in what way would you actually able to mirror the C++ declaration of ezDelegate? Does it even work? This would be a central part of my interop with C++ so making it work would be nice. Kind Regards Benjamin Thaut
Feb 16 2015
"Benjamin Thaut" wrote in message news:mbtena$2n46$1 digitalmars.com...I understand that "void function()" is actually a function pointer and thus the mangling is "correct". But in what way would you actually able to mirror the C++ declaration of ezDelegate? Does it even work? This would be a central part of my interop with C++ so making it work would be nice.struct X(T) { pragma(msg, X.stringof); } void main() { X!(typeof(*(void function()).init)) x; }
Feb 16 2015
Am 17.02.2015 um 02:21 schrieb Daniel Murphy:struct X(T) { pragma(msg, X.stringof); } void main() { X!(typeof(*(void function()).init)) x; }Error: ICE: Unsupported type void() So close...
Feb 16 2015
"Benjamin Thaut" wrote in message news:mbuok2$pn5$1 digitalmars.com...Error: ICE: Unsupported type void() So close...Good news is that that's a compiler bug and not a language limitation. Although allowing you to pass a function type to a template in the first place might also be a compiler bug. D/C++ interop really works best when you can massage the C++ side a little.
Feb 16 2015
On 2/16/2015 11:42 PM, Daniel Murphy wrote:"Benjamin Thaut" wrote in message news:mbuok2$pn5$1 digitalmars.com...True, it might be easier to adjust the C++ side so it takes a pointer to a function type.Error: ICE: Unsupported type void() So close...Good news is that that's a compiler bug and not a language limitation. Although allowing you to pass a function type to a template in the first place might also be a compiler bug. D/C++ interop really works best when you can massage the C++ side a little.
Feb 17 2015
On Tuesday, 17 February 2015 at 08:16:37 UTC, Walter Bright wrote:True, it might be easier to adjust the C++ side so it takes a pointer to a function type.In this case it would be really ugly ezDelegate<void()> vs ezDelegate<void(*)()> I will do a pull request later today fixing this mangling issue.
Feb 17 2015
On 2/16/2015 10:54 PM, Benjamin Thaut wrote:Am 17.02.2015 um 02:21 schrieb Daniel Murphy:Please file bugzilla!struct X(T) { pragma(msg, X.stringof); } void main() { X!(typeof(*(void function()).init)) x; }Error: ICE: Unsupported type void() So close...
Feb 17 2015
Am 17.02.2015 um 09:13 schrieb Walter Bright:On 2/16/2015 10:54 PM, Benjamin Thaut wrote:https://issues.dlang.org/show_bug.cgi?id=14195 https://github.com/D-Programming-Language/dmd/pull/4419Am 17.02.2015 um 02:21 schrieb Daniel Murphy:Please file bugzilla!struct X(T) { pragma(msg, X.stringof); } void main() { X!(typeof(*(void function()).init)) x; }Error: ICE: Unsupported type void() So close...
Feb 17 2015
On 2/17/2015 11:25 AM, Benjamin Thaut wrote:Am 17.02.2015 um 09:13 schrieb Walter Bright:Thank youPlease file bugzilla!https://issues.dlang.org/show_bug.cgi?id=14195 https://github.com/D-Programming-Language/dmd/pull/4419
Feb 17 2015