Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Gcc complain about typename

Reply
Thread Tools

Gcc complain about typename

 
 
Xavier Decoret
Guest
Posts: n/a
 
      07-04-2003
I got the following piece of code:

template <class T,class V>
class ClusterLeaf : public Cluster<T,V>
{
public:
// ...
protected:
friend class Cluster<T,V>;
friend class Cluster<T,V>::const_iterator;


The last line compiles fine on gcc3.3 but issues a warning that is:
cluster.h:109: warning: `Cluster<T, V>::const_iterator'
is implicitly a typename

Before gcc3.3 I was using an earlier version (gcc3 or maybe gcc2.96) and
the incriminated line was actually changed by:
friend typename Cluster<T,V>::const_iterator;

But now that I use gcc3.3, the above line won't compile with a warning
saying friend requires the class keyword.


I know it looks compiler specific but the question is actually: what
should be the proper way of specifying this. Does friend require "class"
all the time according to the standard? What about typename? As far as I
understood, typename is required when the compiler could mistake the
type (the example of T::type* p which can actually be a multiplication).
But after the friend keyword, it should know a type is coming?

Thanks for any element that would help identify the problem and
eventually check with the gcc guys.
--
+-------------------------------------------------+
| Xavier Décoret - Post Doct |
| Graphics Lab (LCS) - MIT |
| mailto: http://www.velocityreviews.com/forums/(E-Mail Removed) |
| home : http://www.graphics.lcs.mit.edu/~decoret|
+-------------------------------------------------+

 
Reply With Quote
 
 
 
 
Dhruv
Guest
Posts: n/a
 
      07-04-2003
On Fri, 04 Jul 2003 00:33:56 -0400, Xavier Decoret wrote:

> I got the following piece of code:
>
> template <class T,class V>
> class ClusterLeaf : public Cluster<T,V>
> {
> public:
> // ...
> protected:
> friend class Cluster<T,V>;
> friend class Cluster<T,V>::const_iterator;


AFAIK, Should be: friend class typename Cluster<T,V>::const_iterator;

I might be wrong here, though. Because as you said, after friend, the
compiler could know that a type is coming.


-Dhruv.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GCC 3.4.3 and GCC 4.1.2 ashnin C++ 1 07-07-2008 01:10 PM
Q: typename or not typename? Jakob Bieling C++ 2 03-14-2006 03:44 PM
Template construction in old gcc 3.3.3 does not compile in gcc 3.4.4 eknecronzontas@yahoo.com C++ 5 09-17-2005 12:27 AM
gcc 2.95 and gcc 3.2 gouqizi.lvcha@gmail.com C++ 8 03-16-2005 02:34 AM
C99 structure initialization in gcc-2.95.3 vs gcc-3.3.1 Kevin P. Fleming C Programming 2 11-06-2003 05:15 AM



Advertisments