digitalmars.D.bugs - Private bug
- bobef (8/8) Feb 11 2006 ------- a.d
- Jarrett Billingsley (12/20) Feb 11 2006 I think this is what's happening:
- Thomas Kuehne (19/27) Feb 11 2006 -----BEGIN PGP SIGNED MESSAGE-----
------- a.d import b; void main(){a("asd");} ------- b.d private void a(int s,int r){}; public void a(char[] s){}; ------- dmd a.d a.d: module a b.a is private
Feb 11 2006
"bobef" <bobef lessequal.com> wrote in message news:dsk9hb$ugh$1 digitaldaemon.com...------- a.d import b; void main(){a("asd");} ------- b.d private void a(int s,int r){}; public void a(char[] s){}; ------- dmd a.d a.d: module a b.a is privateI think this is what's happening: 1) The overload mechanism works just fine for functions of different protection attributes. 2) When compiling a.d, it checks for overloads in b.d, going definition by definition. It also checks if the calling scope can access the functions. 3) It comes across the private overload first, and throws an error since a.d can't access private members of b.d. I'd say this is a bug, but in the meantime, just define the public overload before the private one. Then DMD comes across that one first when checking overloads, and it works.
Feb 11 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 bobef schrieb am 2006-02-11:------- a.d import b; void main(){a("asd");} ------- b.d private void a(int s,int r){}; public void a(char[] s){}; ------- dmd a.d a.d: module a b.a is privateAdded to DStress as http://dstress.kuehne.cn/run/p/private_10_A.d http://dstress.kuehne.cn/run/p/private_10_B.d http://dstress.kuehne.cn/run/p/private_10_C.d http://dstress.kuehne.cn/run/p/private_10_D.d http://dstress.kuehne.cn/nocompile/p/private_10_E.d http://dstress.kuehne.cn/nocompile/p/private_10_F.d http://dstress.kuehne.cn/nocompile/p/private_10_G.d http://dstress.kuehne.cn/nocompile/p/private_10_H.d http://dstress.kuehne.cn/addon/private_10_Z.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFD7h8M3w+/yD4P9tIRAkv4AJoDN/BxCCS7U1pXa6tQcMzsYz9nngCfXFWx H0h+xomRng67EYuwQp3gxBA= =fe+r -----END PGP SIGNATURE-----
Feb 11 2006