Compiler Error C2785


For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

'declaration1' and 'declaration2' have different return types

The return type of function template specialization differs from the return type of the primary function template.

To correct this error

  1. Check all specializations of the function template for consistency.

The following sample generates C2785:

// C2785.cpp  
// compile with: /c  
template<class T> void f(T);  
template<> int f(int); // C2785  
template<> void f(int); // OK