Thread overview
[Bug 30] New: alias with function pointer and two modules
Mar 09, 2006
d-bugmail
Mar 21, 2006
Thomas Kuehne
Apr 28, 2006
d-bugmail
March 09, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=30

           Summary: alias with function pointer and two modules
           Product: D
           Version: 0.149
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: braddr@puremagic.com
        ReportedBy: benoit@tionex.de


// Module 1 ---------------
module m1;
import m2;

class A{
}

A createA(){
  return new A;
}

alias A function() aliasM1;
void main(){
  aFunc( &createA ); //line 19
}


// Module 2 ---------------
module m2;
import m1;
A aFunc( aliasM1 f ){
  return f(); // line 7
}

// The compiler errors:
m1.d(19): function m2.aFunc (A(*)()) does not match argument types (A(*)())
m1.d(19): cannot implicitly convert expression (& createA) of type A(*)() to
A(*)()
m2.d(7): cannot implicitly convert expression ((*(f))()) of type A to m1.A


-- 

March 21, 2006
d-bugmail@puremagic.com schrieb am 2006-03-09:
> // Module 1 ---------------
> module m1;
> import m2;
>
> class A{
> }
>
> A createA(){
>   return new A;
> }
>
> alias A function() aliasM1;
> void main(){
>   aFunc( &createA ); //line 19
> }
>
>
> // Module 2 ---------------
> module m2;
> import m1;
> A aFunc( aliasM1 f ){
>   return f(); // line 7
> }
>
> // The compiler errors:
> m1.d(19): function m2.aFunc (A(*)()) does not match argument types (A(*)())
> m1.d(19): cannot implicitly convert expression (& createA) of type A(*)() to
> A(*)()
> m2.d(7): cannot implicitly convert expression ((*(f))()) of type A to m1.A

Added to DStess as http://dstress.kuehne.cn/run/f/function_05_A.d http://dstress.kuehne.cn/run/f/function_05_B.d http://dstress.kuehne.cn/run/f/function_05_C.d http://dstress.kuehne.cn/run/f/function_05_D.d http://dstress.kuehne.cn/run/f/function_05_E.d http://dstress.kuehne.cn/run/f/function_05_F.d http://dstress.kuehne.cn/run/f/function_05_G.d

Thomas


April 28, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=30


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla@digitalmars.com  2006-04-28 02:55 -------
Fixed 0.155


--