Compiler Error C2052
'type' : illegal type for case expression
Case expressions must be integer constants.
The following sample generates C2052:
// C2052.cpp
int main() {
int index = 0;
switch (index) {
case 1:
return 24;
case 1.0: // C2052
// try the following line instead
// case 2:
return 23;
}
}
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