This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: template pointer operator conversion


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;
> }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]