Bug 13396 – Non-instance and final methods on extern(C++) interfaces shouldn't be mangled as C++ names

Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-08-29T01:33:00Z
Last change time
2014-08-30T15:36:43Z
Assigned to
nobody
Creator
blah38621

Comments

Comment #0 by blah38621 — 2014-08-29T01:33:02Z
A while back, some changes were made to the C++ mangling, those changes broke the build on an old project of mine which declared the following: extern(C++) public interface ScriptObject // Total size: 0x3C { public: final static T Find(T)(string name) { return T.init; } } and, in another file, it does: ScriptObject.Find!SomeObjectType("SomeObjectType"); This instantiates the template, and the current DMD tries to mangle Find as a C++ function, which obviously fails, because string isn't something you can mangle for C++. I believe that methods with implementations in extern(C++) interfaces should still be using the D calling convention and mangling scheme.
Comment #1 by yebblies — 2014-08-30T13:39:43Z
That would make it impossible to match C++ methods that were inside the class the interface is matching. I think it would be worse to be inconsistent here. The workaround is quite simple - mark those methods with extern(D). I'm marking as invalid as the change was intentional, and the previous acceptance of those methods in a C++ interface was a bug, as far as I know.
Comment #2 by blah38621 — 2014-08-30T15:00:25Z
If a body is defined on the D side though, what is there to match on the C++ side?
Comment #3 by yebblies — 2014-08-30T15:24:48Z
(In reply to Orvid King from comment #2) > If a body is defined on the D side though, what is there to match on the C++ > side? The C++ code could be calling the D body.
Comment #4 by yebblies — 2014-08-30T15:27:00Z
(In reply to yebblies from comment #3) > (In reply to Orvid King from comment #2) > > If a body is defined on the D side though, what is there to match on the C++ > > side? > > The C++ code could be calling the D body. At least, I think that works. But either way all the functions inside the interface should be extern(C++).
Comment #5 by blah38621 — 2014-08-30T15:36:43Z
Alright, that makes sense, I hadn't thought about C++ -> D.