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