https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82728
Bug ID: 82728 Summary: Incorrect -Wunused-but-set-variable warning with a const Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sylvestre at debian dot org Target Milestone: --- with: void foo(void) { const int ID = 1; switch (0) { case ID: break; } } # gcc-7 -Wall -c foo.cpp # gcc-8 -Wall -c foo.cpp foo.cpp: In function 'void foo()': foo.cpp:2:13: warning: variable 'ID' set but not used [-Wunused-but-set-variable] const int ID = 1; ^~