编译器错误 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