This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

strange compiler error message regarding template friend class


Hi, all!

I'm getting strange compiler error message:

> type/value mismatch at argument 2 in template parameter list for âtemplate<class T, link<T> T::* mem> struct baseâ
> expected a constant of type âlink<T> T::*â, got âlink<T> T::*â

, where first âlink<T> T::*â is identical to second one.

The code is following:

-------------------------------------------

template<class T> class link;
template<class T, link<T> T::*mem> class base;

template<class T> class link
{
	//here I want to declare 'base' to be friend of 'link',
	//not quite sure how to do it, any suggestions?
        friend class base<T, link<T> T::*>; // <-- this line triggers error
};

-------------------------------------------

gcc -v: gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)

Is it compiler's bug (error message makes no sense, anyway...),
or the code must be written differently?

Best regards,
Arturs Zoldners


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]