編譯器錯誤 C3540

'type': sizeof 無法套用至包含 'auto' 的類型

sizeof 運算子無法套用至指定的型別,因為它包含 auto 規範。

範例

下列範例會產生 C3540。

// C3540.cpp
// Compile with /Zc:auto
int main() {
    auto x = 123;
    sizeof(x);    // OK
    sizeof(auto); // C3540
    return 0;
}

另請參閱

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