This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
RE: GCC 2.95.2 bug with typename and templates
- To: 'Peter Fraser' <pjf at thinkage dot ca>
- Subject: RE: GCC 2.95.2 bug with typename and templates
- From: Jan Reimers <janr at molienergy dot bc dot ca>
- Date: Tue, 25 Jul 2000 12:36:08 -0700
- Cc: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
Do this:
//start
template <class LB> class C
{
public:
void FillBox(typename LB::DataType &info);
};
template <class LB> void C<LB>::FillBox(typename LB::DataType &info) {};
//end
JR
> -----Original Message-----
> From: Peter Fraser [mailto:pjf@thinkage.ca]
> Sent: Tuesday, July 25, 2000 11:19 AM
> To: 'gcc-bugs@gcc.gnu.org'
> Subject: GCC 2.95.2 bug with typename and templates
>
>
>
> template<class LB> class C
> {
> public:
> typename LB::DataType;
>
> void FillBox(LB::DataType &info);
> };
>
> template<class LB> void C<LB>::FillBox(LB::DataType &info)
> {
> ;
> }
> /*
> gives
>
> bug.cpp:8: variable or field `FillBox' declared void
> bug.cpp:8: ANSI C++ forbids initialization of member `FillBox'
> bug.cpp:8: making `FillBox' static
> bug.cpp:8: ANSI C++ forbids in-class initialization of
> non-const static
> member `FillBox'
> bug.cpp:12: duplicate initialization of C<LB>::FillBox
> bug.cpp:12: conflicting types for `void C<LB>::FillBox'
> bug.cpp:8: previous declaration as `int C<LB>::FillBox'
> bug.cpp:12: syntax error before `{'
>
> gcc is deciding that "LB::Datatype &info" is an expression
> rather that a parameter declaration. gcc is behaving as if
> it is ignoring the "typename" declaration.
>
> verion 2.95.2 under Win2000
> */
>
> ______________________________________
> Peter J Fraser 519 895 1860 x201
> President 519 895 1854 fax
> Thinkage
> 85 McIntyre Dr
> Kitchener
> Ontario N2R 1H6
>