extern(Windows) alias bug

Lionello Lunesu lio at lunesu.remove.com
Tue May 30 02:49:04 PDT 2006


John C wrote:
> The following are not equivalent, though I can't understand why not.
> 
> template TFunc1() {
>   extern(Windows) alias int function(int) TFunc1;
> }
> 
> alias int function(int) funcA;
> template TFunc2() {
>   extern(Windows) alias funcA TFunc2;
> }
> 
> void main() {
>   writefln(TFunc1!().mangleof); // PWiZi
>   writefln(TFunc2!().mangleof); // PFiZi
> }
> 
> So the extern(Windows) gets applied to TFunc1, but not TFunc2.

I think you put the "extern" on the wrong place:

template TFunc1() {
   alias extern(Windows) int function(int) TFunc1;
}

alias int function(int) funcA;
template TFunc2() {
   alias extern(Windows) funcA TFunc2;
}

alias extern(Windows) int function(int) funcB;
template TFunc3() {
   alias funcB TFunc3;
}

void main()
{
   writefln(TFunc1!().mangleof); // PFiZi
   writefln(TFunc2!().mangleof); // PFiZi
   writefln(funcA.mangleof); // PFiZi
   writefln(funcB.mangleof); // PFiZi
   writefln(TFunc3!().mangleof); // PFiZi
}

L.



More information about the Digitalmars-d-bugs mailing list