extern(Windows) alias bug

Regan Heath regan at netwin.co.nz
Mon May 29 15:39:03 PDT 2006


On Mon, 29 May 2006 22:50:23 +0100, John C <johnch_atms at hotmail.com> 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.

At a wild guess.. doesn't the alias:
   alias int function(int) funcA;

have an implicit "D calling convention" (extern(D)?) label/tag/specifier,  
eg.
   alias extern(D) int function(int) funcA;

so, the alias:
   extern(Windows) alias funcA TFunc2;

really reads something like:
   extern(Windows) alias extern(D) int function(int) TFunc2;

and maybe the later one overrules the former?

Regan



More information about the Digitalmars-d-bugs mailing list