4569 – extern(c++) doesn't understand const types, produces bad mangled symbol

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4569 - extern(c++) doesn't understand const types, produces bad mangled symbol
Summary: extern(c++) doesn't understand const types, produces bad mangled symbol
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: patch
Depends on:
Blocks:
Reported: 2010年08月02日 00:53 UTC by Brad Roberts
Modified: 2010年08月02日 17:53 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Brad Roberts 2010年08月02日 00:53:37 UTC
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*)
Comment 1 Walter Bright 2010年08月02日 17:53:21 UTC
http://www.dsource.org/projects/dmd/changeset/594 


AltStyle によって変換されたページ (->オリジナル) /