Compiler Error C3206
'function' : invalid type argument for 'param', missing type argument list on class type 'typename'
A function template is defined as taking a template type argument. However, a template template argument was passed.
The following sample generates C3206:
// C3206.cpp
template <class T>
void f() {}
template <class T>
struct S {};
void f1() {
f<S>(); // C3206
// try the following line instead
// f<S<int> >();
}
Possible resolution:
// C3206b.cpp
// compile with: /c
template <class T>
void f() {}
template <class T>
struct S {};
void f1() {
f<S<int> >();
}
C3206 can also occur when using generics:
// C3206c.cpp
// compile with: /clr
generic <class GT1>
void gf() {}
generic <class T>
value struct GS {};
int main() {
gf<GS>(); // C3206
}
Possible resolution:
// C3206d.cpp
// compile with: /clr
generic <class GT1>
void gf() {}
generic <class T>
value struct GS {};
int main() {
gf<GS<int> >();
}
A class template is not allowed as a template type argument. The following sample raises C3206:
// C3206e.cpp
template <class T>
struct S {};
template <class T>
void func() { // takes a type
T<int> t;
}
int main() {
func<S>(); // C3206 S is not a type.
}
Possible resolution:
// C3206f.cpp
template <class T>
struct S {};
template <class T>
void func() { // takes a type
T t;
}
int main() {
func<S<int> >();
}
If a template template parameter is necessary, then you have to wrap the function in a template class that takes a template template parameter:
// C3206g.cpp
template <class T>
struct S {};
template<template<class> class TT>
struct X {
static void func() {
TT<int> t1;
TT<char> t2;
}
};
int main() {
X<S>::func();
}