Invalid method called - reduced test case

Thomas Kuehne thomas-dloop at kuehne.cn
Tue Mar 7 02:28:15 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom S schrieb am 2006-03-06:
> Thomas Kuehne wrote:
>> Your test case seems to be broken:
>> 
>> === a.d ===
>> private import b;
>> 
>> class Foo : Bar {
>> 	void foo() {
>> 		assert(false);	// this should never be called !
>> 	}
>> }
>> 
>> === b.d ===
>> class Bar {
>> 	private import a;
>> 
>> 	void bar() {
>> 		printf("Bar.bar()\n");
>> 	}
>> }
>> 
>> === main.d ===
>> private import a;
>> 
>> void main() {
>> 	(new Foo()).bar();
>> }
>> 
>> 
>> You call Foo.bar in main - that's exactly the function you didn't expect
>> to execute.
>
> Wrong.
>
> I tell it to call Foo.bar but Foo.foo gets called (the function that 
> contains the assert) :)
>
> The order in which these modules are passed to the compiler is important.

You are right.

Added to DStress as:
http://dstress.kuehne.cn/compile/i/import_13_A.d
http://dstress.kuehne.cn/compile/i/import_13_B.d
http://dstress.kuehne.cn/run/i/import_13_C.d
http://dstress.kuehne.cn/run/i/import_13_D.d
http://dstress.kuehne.cn/run/i/import_13_E.d
http://dstress.kuehne.cn/run/i/import_13_F.d
http://dstress.kuehne.cn/compile/i/import_13_G.d
http://dstress.kuehne.cn/compile/i/import_13_H.d
http://dstress.kuehne.cn/run/i/import_13_I.d
http://dstress.kuehne.cn/run/i/import_13_J.d
http://dstress.kuehne.cn/run/i/import_13_K.d
http://dstress.kuehne.cn/run/i/import_13_L.d
http://dstress.kuehne.cn/compile/i/import_13_M.d
http://dstress.kuehne.cn/compile/i/import_13_N.d
http://dstress.kuehne.cn/run/i/import_13_O.d
http://dstress.kuehne.cn/run/i/import_13_P.d
http://dstress.kuehne.cn/run/i/import_13_Q.d
http://dstress.kuehne.cn/run/i/import_13_R.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFEDWcl3w+/yD4P9tIRArQyAKDG8+UWlPWyLHzgpAE2tpLJQoouGgCgx4Ux
Z79AHuvWLxSt6iLTbj9wnq8=
=9fkG
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list