DMD 0.173 release [Name mangling]

Don Clugston dac at nospam.com.au
Sat Nov 4 10:58:31 PST 2006


Walter Bright wrote:
> Don Clugston wrote:
>> "Template instantiations can now accept alias parameters for local 
>> variables and nested functions."
>>
>> which is of great interest to me, since now meta.prettynameof!() can 
>> work with local variables; this will be significant for DDL and 
>> probably things like PyD as well.
>> But, the name mangling is really weird. It's totally different to the 
>> name mangling for static variables, for example.
> 
> What happens is when one of the parameters is an alias to a local, the 
> template becomes a *nested* class/function, and is mangled like one.

I think I've found a bug in a corner case:

template t (alias A) {...}

void g() {
   void f() {
//    t!(f);   // CASE 1 --->  template t is nested in both g and f.
  }
    t!(f);    // CASE 2 ---> template t is nested in g but not f.
}

If case 1 appears anywhere (even in a pragma(msg)), it changes the name 
mangling of case 2.
I think case 1 is wrong: an inner function is not inside itself.



More information about the Digitalmars-d-announce mailing list