January 02, 2006
// 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 +/
January 03, 2006
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