www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - assertion failure, with, templates

reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
// console_main.d :

class Foo {
	template foo() {
		void foo() {}
	}
}


void main() {
	Foo f = new Foo;
	
	f.foo!()();						// ok
	with (f) foo!()();			// AV !
}


COMPILING:


 dmd console_main.d
console_main.d(12): need 'this' to access member foo
 dmd -inline console_main.d
Assertion failure: 'ids->vthis' on line 404 in file 'inline.c' abnormal program termination Tested with DMD.131, DMD.141 and DMD.142 Obviously, it shouldn't crash the compiler, but must the 'with' construct be disallowed with templates ? Thanks, good luck and happy new year ;) -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Jan 02 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom S schrieb am 2006-01-02:
 // console_main.d :

 class Foo {
 	template foo() {
 		void foo() {}
 	}
 }


 void main() {
 	Foo f = new Foo;
 	
 	f.foo!()();						// ok
 	with (f) foo!()();			// AV !
 }


 COMPILING:


 dmd console_main.d
console_main.d(12): need 'this' to access member foo
 dmd -inline console_main.d
Assertion failure: 'ids->vthis' on line 404 in file 'inline.c' abnormal program termination Tested with DMD.131, DMD.141 and DMD.142 Obviously, it shouldn't crash the compiler, but must the 'with' construct be disallowed with templates ? Thanks, good luck and happy new year ;)
Added to DStress as http://dstress.kuehne.cn/run/w/with_14_A.d http://dstress.kuehne.cn/run/w/with_14_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDul+G3w+/yD4P9tIRAlsuAJ40Rv7jCU58EyIVv7nKYP0vg0hHqACfdBZP c3tTPKMia4zoYwmgvVGwrbU= =62F+ -----END PGP SIGNATURE-----
Jan 03 2006