GCC 2.95.2 bug with typename and templates
Nathan Sidwell
nathan@codesourcery.com
Tue Jul 25 12:35:00 GMT 2000
Peter Fraser wrote:
>
> template<class LB> class C
> {
> public:
> typename LB::DataType;
>
> void FillBox(LB::DataType &info);
> };
> 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.
you misunderstand typename. it must be used at each usage of the
type-dependant type. I.e. either [untested code coming up]
template <class LB> class C
{
public:
typedef typename LB::DataType DataType;
void FillBox (DataType &);
}
template<class LB> void C<LB>::FillBox(DataType &info)
{
;
}
or
template <class LB> class C
{
public:
void FillBox (typename LB::DataType &);
}
template<class LB> void C<LB>::FillBox(typename LB::DataType &info)
{
;
}
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
More information about the Gcc-bugs
mailing list