This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
template question
- From: Zoltan Nagy <nagyz at physics dot uoregon dot edu>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 04 Dec 2002 08:00:20 -0800
- Subject: template question
Hi,
I tried to compile the small code below using the g++-3.2.1 but I got
the following error message:
test.cc: In member function `void C<TTT>::ff() [with TTT = double]':
test.cc:31: instantiated from here
test.cc:20: no matching function for call to `A<double>::f(B<const
double&, double>&, double&)'
Is it a bug in the compiler or I do something wrong?
Cheers,
Zoltan
template<class T1, class T2>
struct B {
typedef T2 res_type;
};
template<class TT>
struct A {
template<class T1, class T2>
void f(const B<T1,T2>&, T1){}
};
B<const double&, double> b;
template <class TTT>
struct C {
void ff() {
double x =12;
a.f(b, x);
}
A<TTT> a;
};
int main()
{
C<double> c;
c.ff();
return 0;
}