Compiler Error C2587
'identifier' : illegal use of local variable as default parameter
Local variables are not allowed as default parameters.
The following sample generates C2587:
// C2587.cpp
// compile with: /c
int i;
void func() {
int j;
extern void func2( int k = j ); // C2587 -- local variable
extern void func3( int k = i ); // OK
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for