Compiler Error C3532
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3532.
type': incorrect usage of 'auto'
The indicated type cannot be declared with the auto keyword. For example, you cannot use the auto keyword to declare an array or a method return type.
To correct this error
Ensure that the initialization expression yields a valid type.
Ensure that you do not declare an array or a method return type.
The following example yields C3532 because the auto keyword cannot declare a method return type.
// C3532a.cpp
// Compile with /Zc:auto
auto f(){} // C3532
The following example yields C3532 because the auto keyword cannot declare an array.
// C3532b.cpp
// Compile with /Zc:auto
int main()
{
int x[5];
auto a[5]; // C3532
auto b[1][2]; // C3532
auto y[5] = x; // C3532
auto z[] = {1, 2, 3}; // C3532
auto w[] = x; // C3532
return 0;
}
Show: