This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: template pointer operator conversion
- To: Peter Garrone <Garrone at ali dot com dot au>
- Subject: Re: template pointer operator conversion
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Thu, 25 Jan 2001 07:48:40 +0000
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <90C7E73AEFA6D411AD7D0000D11C18E1B36D74@exchangeserver.ali>
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;
> }