[Issue 14831] New: Each function local symbols should have unique mangled name
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jul 26 06:36:04 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14831
Issue ID: 14831
Summary: Each function local symbols should have unique mangled
name
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: k.hara.pg at gmail.com
Blocks: 9748, 10619, 14820
Typical example:
module test;
void main()
{
{ int x; pragma(msg, x.mangleof); } // _D4test4mainFZ1xi
{ int x; pragma(msg, x.mangleof); } // _D4test4mainFZ1xi
}
Even if two or more different function local symbols have same name, their
mangled name should be unique.
---
Currently the mangling issue causes many pragmatic problems.
https://issues.dlang.org/show_bug.cgi?id=10619
If the same name symbols are captured by TemplateAliasParameter, the
corresponding template instances will be entangled.
https://issues.dlang.org/show_bug.cgi?id=14820
If the symbols declared in unrolled loop (compile-time iterated foreach)
statement, they're easily entangled.
https://issues.dlang.org/show_bug.cgi?id=9748
The problem is not only for variables, but also function local templates and
template functions.
---
Currently function local functions, type definitions, and static variables are
not allowed.
module test;
void main()
{
{ void f() {} pragma(msg, f.mangleof); }
{ void f() {} pragma(msg, f.mangleof); } // error
{ struct S {} pragma(msg, S.mangleof); }
{ struct S {} pragma(msg, S.mangleof); } // ICE
{ class C {} pragma(msg, C.mangleof); }
{ class C {} pragma(msg, C.mangleof); } // ICE
{ enum E { a } pragma(msg, E.mangleof); }
{ enum E { a } pragma(msg, E.mangleof); } // error
{ static int v = 0; pragma(msg, v.mangleof); }
{ static int v = 1; pragma(msg, v.mangleof); } // error
}
However, I think the rejections are not so meaningful. I cannot see any reason
to limit such the static function local symbols to unique.
--
More information about the Digitalmars-d-bugs
mailing list