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: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Tue, 25 Jul 2000 20:38:19 +0100
- CC: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
- Organization: Codesourcery LLC
- References: <5FCE753AF6D4D311BD0F00A0C91FEA8502FDA7@mailx.thinkage.ca>
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