473,503 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gcc complain about typename

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: de*****@graphics.lcs.mit.edu |
| home : http://www.graphics.lcs.mit.edu/~decoret|
+-------------------------------------------------+

Jul 19 '05 #1
1 3328
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.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3190
by: Roy Yao | last post by:
Why the following code let my compiler complain an overloaded function Init()? // code begin template<class T> class BicircularList { template<class T> class Iterator; template<class T> class...
1
3834
by: I wish | last post by:
I wrote some test code template <typename T> class A {}; class B{}; template < template <typename T> typename U > class C {}; int main( void )
2
2677
by: Chris Foster | last post by:
Hi, I'm having some difficulty using types which are defined in a base class inside a derived class. The problem crops up using template classes. The following test code encapsulates what I'd...
1
1745
by: lutorm | last post by:
Hi all, I'm working on migrating my code from KCC to gcc, and I'm having some issues with "implicit typename" warnings from gcc. Essentially, what happens is described by this example: ...
13
1690
by: Staffan Langin | last post by:
Hello, In the following code-snippet, template<class Base> class Foo : public Base {
1
1435
by: Carlos Martinez Garcia | last post by:
Hi all: I have the template class: template<typename InfoTabla> class TablaBusqueda { typename InfoTabla::Tabla TipoTabla; typename InfoTabla::Registro TipoRegistro; typename...
8
1764
by: xuatla | last post by:
Hi, When I compile the following test code I got a warning about implicit typename. This happens in the member functions. Do you know the detail reason and solution? Thanks. - X ----------
1
1818
by: ma740988 | last post by:
I'm wading my way through Josuttis template text. I'm having a hard time understanding some things. So given: template <class T> class generic_traits { public: typedef T value_type; };...
7
2111
by: StephQ | last post by:
First of all: distinction of keywords typename and class in template arguments. Accoarding to a post in a well known moderated group: "There are three possibilities for template arguments: 1)...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.