Bug 6600 – unrelated expression alters function name mangling
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
FreeBSD
Creation time
2011-09-03T14:31:00Z
Last change time
2013-01-16T21:26:47Z
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2011-09-03T14:31:52Z
void funOneArg()() {}
void func_pure_nothrow() pure nothrow {}
void foo()
{
// commenting the next line in/out will change the mangling of *f2
// enum f1 = &curry!funOneArg;
enum f2 = &func_pure_nothrow;
pragma(msg, typeof(*f2));
pragma(msg, typeof(*f2).mangleof);
}
auto curry(alias fun, Args...)(Args args)
{
return fun(args);
}
---
Roughly the issue is that the deco member for TypeFunction isn't updated
when purityLevel is deduced lazily.
In detail:
TypePointer for f1 and f2 are merged as their types are already equal when evaluating the AddrExp.
Now both TypePointer alias the same TypeFunction but that was created from a function without 'pure nothrow'. That's why the deco buffer does still contain unattributed function.
There is also the side issue that f2's TypeFunction suddenly has an empty
tuple parameter.