Issue 10249 - incorrect mangling for overloaded symbol#2125
Issue 10249 - incorrect mangling for overloaded symbol#2125WalterBright merged 1 commit intodlang:masterfrom
Conversation
|
Don't merge this yet. |
|
Ok. Ready to merge. |
src/declaration.h
Outdated
There was a problem hiding this comment.
A brief documentation? At least for the new code :o).
|
OK. Updated code. |
|
lgtm, anyone up for a semantic review? |
|
What is the difference between mangle() and mangleExact()? I don't understand what is happening in the code, and how 10249 is fixed. Can you please provide some comments in the code? |
|
@WalterBright module test;
void foo(long) {} // _D4test3fooFlZv
void foo(string) {} // _D4test3fooFAyaZv
pragma(msg, foo.mangleof);
// Currently prints "_D4test3fooFlZv", which is calculated by
// `FuncDeclaration::mangle()` of void foo(long)But this is not good. After the change, pragma(msg, foo.mangleof);
// After this change, prints "4test3foo" by calling `Dsymbol::mangle()`,
// instead of `FuncDeclaration::mangleExact()`.
pragma(msg, __traits(getOverloads, test, "foo")[0].mangleof); // _D4test3fooFlZv
pragma(msg, __traits(getOverloads, test, "foo")[1].mangleof); // _D4test3fooFAyaZvIf a function has no overloads, void bar() {}
pragma(msg, bar.mangleof);
// still prints _D4test3barFZv by calling `FuncDeclaration::mangleExact()` from `FuncDeclaration::mangle()`. |
|
Thanks for the explanation! Can you please add these as comments in the code? |
|
@WalterBright OK. Updated code comment on |
Issue 10249 - incorrect mangling for overloaded symbol
http://d.puremagic.com/issues/show_bug.cgi?id=10249