www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4569] New: extern(c++) doesn't understand const types, produces bad mangled symbol

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: braddr puremagic.com


--- Comment #0 from Brad Roberts <braddr 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: -------
Aug 02 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4569


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2010-08-02
17:53:21 PDT ---
http://www.dsource.org/projects/dmd/changeset/594

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