Bug 30 – alias with function pointer and two modules

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-03-09T17:27:00Z
Last change time
2014-02-15T02:09:53Z
Assigned to
bugzilla
Creator
benoit

Comments

Comment #0 by benoit — 2006-03-09T17:27:30Z
// 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
Comment #1 by thomas-dloop — 2006-03-21T04:50:40Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] 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 -----BEGIN PGP SIGNATURE----- iD8DBQFEH+aa3w+/yD4P9tIRAqRZAKDIVz+vRtJeigddf3bKHtfdGp2DXwCfVjge ITvX46ElHEre/fuOaD2q7NU= =Y2DF -----END PGP SIGNATURE-----
Comment #2 by bugzilla — 2006-04-28T02:55:14Z
Fixed 0.155