The Bug is Regarding `case value`. I have commented the bug in the program below. #include <stdio.h> int main() { int n = 0; switch(n) { case 1: printf("Foo.\n"); break; /* The following Syntax Error is not being detected, i.e no space between 'case' & 2 */ case2: printf("Bar.\n"); break; default: printf("Bruhh.\n"); } return 0; } Thanks, Hage Ropo
case2: is a label. There is no syntax error here because this is very valid C. We should most likely warn about it though or at least have an option to warn about it. Confirmed for the warning.
Thanks for filing this bug. We already issue a warning for this within -Wall, via -Wunused-label (since sometime at or before gcc 4.4, I think): test.c: In function ‘main’: test.c:18:3: warning: label ‘case2’ defined but not used [-Wunused-label] case2: ^~~~~ I think that if the user accidentally omits the space between the "case" and the value, they're unlikely to also have a reference to that label name. Marking this one as resolved. Feel free to reopen if I'm missing something here.