Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Compiler Error C3537

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see Compiler Error C3537 on docs.microsoft.com. 'type': you cannot cast to a type that contains 'auto'

You cannot cast a variable to the indicated type because the type contains the auto keyword and the default /Zc:auto compiler option is in effect.

The following code yields C3537 because the variables are cast to a type that contains the auto keyword.

// C3537.cpp  
// Compile with /Zc:auto  
int main()  
{  
   int value = 123;  
   auto(value);                        // C3537  
   (auto)value;                        // C3537  
   auto x1 = auto(value);              // C3537  
   auto x2 = (auto)value;              // C3537  
   auto x3 = static_cast<auto>(value); // C3537  
   return 0;  
}  

auto Keyword

Show:
© 2017 Microsoft