← Back to index
|
Original Bugzilla link
Bug 11696 – C++ incorrect static member mangling
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-06T01:40:00Z
Last change time
2015-06-09T05:11:49Z
Assigned to
nobody
Creator
ibuclaw
Comments
Comment #0
by ibuclaw — 2013-12-06T01:40:56Z
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_
Comment #1
by ibuclaw — 2013-12-06T01:50:43Z
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_'
Comment #2
by ibuclaw — 2013-12-06T03:52:53Z
https://github.com/D-Programming-Language/dmd/pull/2928
Comment #3
by github-bugzilla — 2013-12-10T08:44:10Z
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
Comment #4
by ibuclaw — 2013-12-10T08:45:35Z
https://github.com/D-Programming-Language/dmd/commit/7b0bf9623cbb10ae7480befa2685a6baa575c812