This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
strange compiler error message regarding template friend class
- From: Arturs Zoldners <az at tuci dot lv>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 13 Apr 2007 08:25:11 +0300
- Subject: strange compiler error message regarding template friend class
- Reply-to: az at tuci dot lv
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