1

Possible Duplicate:
C++, template argument can not be deduced

I have the following code:

template<typename T>
struct A { };

template<typename T>
struct B
{
    typedef A<T> NestedA;
};

template<typename T>
void f(typename B<T>::NestedA a) { }

void g()
{
    B<int>::NestedA a;
    f(a); //g++ error: no matching function for call to ‘f(A<int>&)’
}

Why does g++ 4.4.3 complain here? Why it can not deduce the type of a? It is not even a nested type, but a nested typedef. After all isn't typedef an alias for a type?

Community
  • 1
  • 1
Sogartar
  • 2,035
  • 2
  • 19
  • 35

0 Answers0