編譯器錯誤 C3533

'type': 參數不能有包含 'auto' 的類型

如果預設 /Zc:auto 編譯器選項生效,就無法使用 auto 關鍵字宣告方法或範本參數。

更正這個錯誤

  1. auto從參數宣告中移除 關鍵字。

範例

下列範例會產生 C3533,因為它使用 關鍵字宣告函式參數 auto ,並使用 /Zc:auto 編譯

// C3533a.cpp
// Compile with /Zc:auto
void f(auto j) {} // C3533

下列範例會在 C++14 模式中產生 C3533,因為它以 關鍵字宣告範本參數 auto ,並使用 /Zc:auto 編譯 。(在 C++17 中,這是類別範本的有效定義,具有推斷其類型的單一非類型樣板參數。

// C3533b.cpp
// Compile with /Zc:auto
template<auto T> class C {}; // C3533

另請參閱

auto 關鍵字
/Zc:auto (推算變數類型)