X
Xavier Decoret
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: (e-mail address removed) |
| home : http://www.graphics.lcs.mit.edu/~decoret|
+-------------------------------------------------+
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: (e-mail address removed) |
| home : http://www.graphics.lcs.mit.edu/~decoret|
+-------------------------------------------------+