template pointer operator conversion

Neil Booth neil@daikokuya.demon.co.uk
Wed Jan 24 23:48:00 GMT 2001


Your code compiles without diagnostics with CVS G++, so it should be
fixed for GCC 3.0.

Neil.

Peter Garrone wrote:-
> //using gcc 2.95.2, the following generates a compilation
> //error, unable to resolve the pointer.
> //specifically:
> //tt.cpp: In function `int func()':
> //tt.cpp:26: `class tclass<int>' used where a `int' was expected
> //But instancing the class separately solves the problem!!
> //#define NO_COMPILE_ERROR
> 
> template<class vtype>
> class tclass
> {
> 	vtype x;
> public:
>   	operator vtype(){ return x;}
> };
> 
> 
> tclass<int>  *tcl;
> 
> #ifdef NO_COMPILE_ERROR
> tclass<int>  tcli;
> #endif
> 
> int func(void)
> {
> 	int d = *tcl;
> 	return 0;
> }


More information about the Gcc-bugs mailing list