[dmd-internals] Type mangling for deduced attributes

kenji hara k.hara.pg at gmail.com
Tue Nov 15 18:23:01 PST 2011


2011/9/4 Walter Bright <walter at digitalmars.com>:
>
>
> On 9/3/2011 5:56 PM, Martin Nowak wrote:
>>
>> I've stumbled over the fact that deduced function attributes (pure,
>> nothrow) are not reflected
>> in the name mangling. Is this a bug or by design?
>>
>
> It is by design. I think that's the right choice, but I'm not positive.

I think .mangleof property should return the actual value (based on
the real type).
Otherwise, we cannot guarantee the pure/nothrow/safe attributes in ABI level.

But, to realize it dmd should implement full deferred semantic mechanism.
It would run its semantic3() with getting .mangleof property, even if
a target function declaration is in module level.

module test;
void foo()() {}
alias foo!() f;
pragma(msg, typeof(f).mangleof);
// Actually f has pure/nothrow/@safe attributes by their inference.
// But pragma prints "FZv", because instantiating foo!() in module
level does not run semantic3().
// To print "FNaNbNfZv", we need *full deferred semantic* mechanism, IMO.

Kenji Hara


More information about the dmd-internals mailing list