This documentation is archived and is not being maintained.

Compiler Error C2770

invalid explicit template argument(s) for 'template'

Function template candidates with explicit template arguments resulted in disallowed function types.

The following sample generates C2770:

// C2770.cpp
#include <stdio.h>
template <class T>
int f(typename T::B*);   // expects type with member B

struct Err { };

struct OK {
   struct B { };

int main() {
   int i = f<int>(0);   // C2770 int has no B
   i = f<Err>(0);   // C2770 Err has no B
   i = f<OK>(0);   // OK has a B