共用方式為


編譯器錯誤 C3541

'type': typeid 無法套用至包含 'auto' 的型別

typeid (C++ 元件擴充功能) 運算子無法套用至指定的型別,因為它包含 auto 規範。

範例

下列範例會產生 C3541 錯誤。

// C3541.cpp
// Compile with /Zc:auto
#include <typeinfo>
int main() {
    auto x = 123;
    typeid(x);    // OK
    typeid(auto); // C3541
    return 0;
}

請參閱

參考

auto 關鍵字

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

typeid (C++ 元件擴充功能)