Partager via


Compiler Error C3541

'type': typeid cannot be applied to a type that contains 'auto'

The typeid (C++ Component Extensions) operator cannot be applied to the indicated type because it contains the auto specifier.

Example

The following example yields C3541.

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

See Also

Reference

auto Keyword

/Zc:auto (Deduce Variable Type)

typeid (C++ Component Extensions)