Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread kinke via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 00:25:56 UTC, Jamie wrote: Happy to file a bug, but if it was a bug in the mangler wouldn't both C++ and D get the same result? Assuming D uses the same mangler for the extern(C++) stuff. Bug in the D frontend implementation of Itanium C++ mangling.

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 23:39:38 UTC, Ali Çehreli wrote: On 10/13/20 4:11 PM, James Blachly wrote: On 10/13/20 5:23 AM, Jamie wrote: I think the issue is with D's "turtles all the way down" style const. My workaround would be to define wrapper functions that may need to do casting on

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 23:47:24 UTC, kinke wrote: On Tuesday, 13 October 2020 at 09:23:48 UTC, Jamie wrote: It appears that func3 and func4 take on different types depending on other variables being present? Is this expected? Nope, it's a bug in the Itanium C++ mangler, please file a

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread kinke via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 09:23:48 UTC, Jamie wrote: It appears that func3 and func4 take on different types depending on other variables being present? Is this expected? Nope, it's a bug in the Itanium C++ mangler, please file a bug. MSVC++ mangling seems fine, after fixing the D

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread Ali Çehreli via Digitalmars-d-learn
On 10/13/20 4:11 PM, James Blachly wrote: On 10/13/20 5:23 AM, Jamie wrote: Building with: g++ -c a.cpp dmd main.d a.o Throws the error: /usr/bin/ld: main.o: in function `_Dmain': main.d:(.text._Dmain[_Dmain]+0x31): undefined reference to `void func3(int*, int*)' /usr/bin/ld:

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread James Blachly via Digitalmars-d-learn
On 10/13/20 5:23 AM, Jamie wrote: Building with: g++ -c a.cpp dmd main.d a.o Throws the error: /usr/bin/ld: main.o: in function `_Dmain': main.d:(.text._Dmain[_Dmain]+0x31): undefined reference to `void func3(int*, int*)' /usr/bin/ld: main.d:(.text._Dmain[_Dmain]+0x3e): undefined reference to

Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
I'm having difficulties linking templated functions with multiple pointer arguments with extern(C++). a.cpp - template void func1(T *b){} template void func1(int *b); template void func2(const T *a){} template void func2(const int *a); template void func3(T *b, const T *a){} template void