Bug 4268 – (D1 only) ambiguous name mangling for local functions
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2010-06-04T05:46:00Z
Last change time
2015-09-28T12:45:51Z
Assigned to
nobody
Creator
r.sagitario
Comments
Comment #0 by r.sagitario — 2010-06-04T05:46:37Z
This code:
module test;
struct struc
{
struct fnb {}
}
struc fna()
{
struct fnb
{
static void fnc()
{
static struct x {}
pragma(msg,x.mangleof);
}
}
return struc();
}
struc.fnb fna()
{
static void fnc()
{
static struct x {}
pragma(msg,x.mangleof);
}
return struc.fnb();
}
outputs with "dmd -c test.d"
S4test3fnaFZS4test5struc3fnb3fncFZv1x
S4test3fnaFZS4test5struc3fnb3fncFZv1x
so both functions fnc have the same mangled name.
This seems like a very constructed situation, but it just illustrates that std.demangle cannot create correct output for local functions if the outer function returns a qualified type. This happens because there is no seperator between the return type and the identifier of the local symbol name.
As a result, local functions might not show up correctly in call stacks.
Comment #1 by lt.infiltrator — 2014-03-19T18:05:42Z
Related to Issue 5957?
Comment #2 by r.sagitario — 2014-03-19T23:01:59Z
(In reply to comment #1)
> Related to Issue 5957?
Only slightly. This shows problems with the return type, while Issue 5957 deals with template arguments.
Comment #3 by k.hara.pg — 2014-03-28T20:39:20Z
By fixing issue 12352, the mangled name conflict is now resolved from 2.066 git-head.
And, the two fna functions (struc fna() and struc.fnb fna()) should be rejected in semantic analysis phase. It would be a dup of issue 2999.
*** This issue has been marked as a duplicate of issue 12352 ***
Comment #4 by k.hara.pg — 2014-03-28T20:41:24Z
Keeping it opened as D1 only issue.
Comment #5 by github-bugzilla — 2015-09-28T10:57:11Z