www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11696] New: C++ incorrect static member mangling

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11696

           Summary: C++ incorrect static member mangling
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ibuclaw ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw ubuntu.com> 2013-12-06 01:40:56 PST ---
class.d:
---
class Expression;
struct Loc { }

extern(C++)
class CallExp
{
    static CallExp *factory(Loc, Expression, Expression)
    {
      assert(0);
    }
}

class.cc
---
class Expression;
struct Loc { };

class CallExp
{
  public:
    static CallExp *factory(Loc, Expression*, Expression*);
};

CallExp *CallExp::factory(Loc, Expression*, Expression*) { }


G++ produces the following mangled symbol for factory:
_ZN7CallExp7factoryE3LocP10ExpressionS2_

Whereas cppmangle in the dfrontend produces:
_ZN7CallExp7factoryE3LocP10ExpressionS1_

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11696


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com


--- Comment #1 from Iain Buclaw <ibuclaw ubuntu.com> 2013-12-06 01:50:43 PST ---
G++ mangling process:

  mangled-name            : function_decl            (0x7f21d4fbd400)
  encoding                : function_decl            (0x7f21d4fbd400)
  name                    : function_decl            (0x7f21d4fbd400)
  nested-name             : function_decl            (0x7f21d4fbd400)
  prefix                  : record_type              (0x7f21d4fbf3f0)
  ++ find_substitution (record_type at 0x7f21d4fbf3f0)
  unqualified-name        : type_decl                (0x7f21d4fb8ac8)
  source-name             : identifier_node          (0x7f21d4fd0bb0)
  identifier              : CallExp                 
  ++ add_substitution (record_type at 0x7f21d4fbf3f0)
  ++ substitutions   S-1_ = CallExp (record_type at 0x7f21d4fbf3f0)
  unqualified-name        : function_decl            (0x7f21d4fbd400)
  source-name             : identifier_node          (0x7f21d4fd0c08)
  identifier              : factory                 
  bare-function-type      : function_type            (0x7f21d4fbf690)
  type                    : record_type              (0x7f21d4fbf150)
  ++ find_substitution (record_type at 0x7f21d4fbf150)
  name                    : type_decl                (0x7f21d4fb8958)
  unscoped-name           : type_decl                (0x7f21d4fb8958)
  unqualified-name        : type_decl                (0x7f21d4fb8958)
  source-name             : identifier_node          (0x7f21d4fd0b58)
  identifier              : Loc                     
  ++ add_substitution (record_type at 0x7f21d4fbf150)
  ++ substitutions   S-1_ = CallExp (record_type at 0x7f21d4fbf3f0)
                     S0_ = Loc (record_type at 0x7f21d4fbf150)
  type                    : pointer_type             (0x7f21d4fbf540)
  ++ find_substitution (pointer_type at 0x7f21d4fbf540)
  type                    : record_type              (0x7f21d4fbf0a8)
  ++ find_substitution (record_type at 0x7f21d4fbf0a8)
  name                    : type_decl                (0x7f21d4fb88a0)
  unscoped-name           : type_decl                (0x7f21d4fb88a0)
  unqualified-name        : type_decl                (0x7f21d4fb88a0)
  source-name             : identifier_node          (0x7f21d4fd0b00)
  identifier              : Expression              
  ++ add_substitution (record_type at 0x7f21d4fbf0a8)
  ++ substitutions   S-1_ = CallExp (record_type at 0x7f21d4fbf3f0)
                     S0_ = Loc (record_type at 0x7f21d4fbf150)
                     S1_ = Expression (record_type at 0x7f21d4fbf0a8)
  ++ add_substitution (pointer_type at 0x7f21d4fbf540)
  ++ substitutions   S-1_ = CallExp (record_type at 0x7f21d4fbf3f0)
                     S0_ = Loc (record_type at 0x7f21d4fbf150)
                     S1_ = Expression (record_type at 0x7f21d4fbf0a8)
                     S2_ = ??? (pointer_type at 0x7f21d4fbf540)
  type                    : pointer_type             (0x7f21d4fbf540)
  ++ find_substitution (pointer_type at 0x7f21d4fbf540)
  substitution            :                         
mangle_decl_string = '_ZN7CallExp7factoryE3LocP10ExpressionS2_'

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11696



--- Comment #2 from Iain Buclaw <ibuclaw ubuntu.com> 2013-12-06 03:52:53 PST ---
https://github.com/D-Programming-Language/dmd/pull/2928

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11696



--- Comment #3 from github-bugzilla puremagic.com 2013-12-10 08:44:10 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/99826375f9c5c56799d17f470ff1bb4e53bce743
Fix Issue 11696 - incorrect static C++ member mangling

https://github.com/D-Programming-Language/dmd/commit/7b0bf9623cbb10ae7480befa2685a6baa575c812
Merge pull request #2928 from ibuclaw/cppclass

Fix Issue 11696 - incorrect static C++ member mangling

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11696


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Iain Buclaw <ibuclaw ubuntu.com> 2013-12-10 08:45:35 PST ---
https://github.com/D-Programming-Language/dmd/commit/7b0bf9623cbb10ae7480befa2685a6baa575c812

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