共用方式為


編譯器錯誤 C2785

'declaration1' 和 'declaration2' 有不同的傳回類型

函式範本特製化的傳回類型與主要函式範本的傳回類型不同。

更正這個錯誤

  1. 檢查函式範本的所有特製化,以取得一致性。

範例

下列範例會產生 C2785:

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

template<> int f(int); // C2785
template<> void f(int); // OK