This documentation is archived and is not being maintained.

Compiler Error C2785

'declaration1' and 'declaration2' have different return types

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

Example

// C2785.cpp
template<class T> void f(T);
template<> int f(int); // C2785

Check all specializations of the function template for consistency.

Show: