[Issue 17379] Mangle voldemort types as if they are defined in the outer scope to avoid exponential symbol name length with templates
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 1 14:43:48 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=17379
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WONTFIX |---
--- Comment #7 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Reopening, in case someone wishes to tackle this issue with the hairy problems
it has.
The largest blocking issue to getting this to work is if you have 2 overloads
of the same function template (this is completely made up, but something
similar would cause problems):
auto foo(T)(T t, int x)
{
static struct Result {T t; int x;}
return Result(t, x);
}
auto foo(T)(T t, string x)
{
static struct Result {T t; string x;}
return Result(t, x);
}
If you refactor this, then the Result struct doesn't get properly mangled -- it
only depends on the template itself. This will produce 2 identical manglings
for the 2 functions.
Note that if you do actually do the refactoring here (move the Result outside
the function), the current compiler simply doesn't redefine the Result struct
-- it considers it fully defined in the first overload.
So a user would not refactor both, he would get errors on his compilation. But
the compiler that was just adjusting the mangling would cause other problems.
--
More information about the Digitalmars-d-bugs
mailing list