[Issue 10058] New: Inconsistent mangling between C++ and extern(C++).

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 10 08:24:14 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10058

           Summary: Inconsistent mangling between C++ and extern(C++).
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ibuclaw at ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw at ubuntu.com> 2013-05-10 08:24:13 PDT ---
Noticed this when looking at bug 7024.

test.cc:
void foo1(void*) {}
void foo2(void (*)(void*)) {}
void foo3(void* (*)(void*)) {}
void foo4(void (*)(void*), void*) {}
void foo5(void* (*)(void*), void*) {}
void foo6(void (*)(void*), void*, void*) {}
void foo6(void* (*)(void*), void*, void*) {}


test.d:
extern(C++) void foo1(void*) {}
extern(C++) void foo2(void function(void*)) {}
extern(C++) void foo3(void* function(void*)) {}
extern(C++) void foo4(void function(void*), void*) {}
extern(C++) void foo5(void* function(void*), void*) {}
extern(C++) void foo6(void function(void*), void*, void*) {}
extern(C++) void foo6(void* function(void*), void*, void*) {}


g++ produces following mangling:
---
_Z4foo1Pv
_Z4foo2PFvPvE
_Z4foo3PFPvS_E
_Z4foo4PFvPvES_
_Z4foo5PFPvS_ES_
_Z4foo6PFvPvES_S_
_Z4foo6PFPvS_ES_S_
---

dmd produces following mangling:
---
_Z4foo1Pv
_Z4foo2PFvPvE
_Z4foo3PFPvS0_E
_Z4foo4PFvPvES0_
_Z4foo5PFPvS0_ES0_
_Z4foo6PFvPvES0_S0_
_Z4foo6PFPvS0_ES0_S0_
---


The code in cppmangle.c is:
---
/* Sequence is S_, S0_, .., S9_, SA_, ..., SZ_, S10_, ...
 */
buf->writeByte('S');
if (i)
    writeBase36(buf, i - 1);
---


So something is wrong with the logic before this point...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list