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

           Summary: extern(c++) doesn't understand const types, produces
                    bad mangled symbol
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bra...@puremagic.com


--- Comment #0 from Brad Roberts <bra...@puremagic.com> 2010-08-02 00:53:37 PDT 
---
diff --git a/src/cppmangle.c b/src/cppmangle.c
index 7023614..9ed6ff3 100644
--- a/src/cppmangle.c
+++ b/src/cppmangle.c
@@ -198,6 +198,9 @@ void TypeBasic::toCppMangle(OutBuffer *buf, CppMangleState
*cms)
      * u <source-name>  # vendor extended type
      */

+    if (isConst())
+        buf->writeByte('K');
+
     switch (ty)
     {
         case Tvoid:     c = 'v';        break;


test case, foo.d:
extern(C++) void foo(const char *);
void bar(){ foo(""); }

$ dmd -c foo.d
$ nm foo.o | grep foo
         U _Z3fooPc

With the fix:
         U _Z3fooPKc

$ echo _Z3fooPc | c++filt 
foo(char*)
$ echo _Z3fooPKc | c++filt
foo(char const*)

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

Reply via email to