編譯器錯誤 C3541

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

typeid 運算子無法套用至指定的型別,因為它包含 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