https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77887
Bug ID: 77887 Summary: -Wimplicit-fallthrough fails to trigger in an unused function template specialisation Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marc.mutz at kdab dot com Target Milestone: --- I have a switch statement here that -Wimplicit-fallthrough fails to warn about: template <> inline void qt_memfill_template(quint16 *dest, quint16 value, int count) { if (count < 3) { switch (count) { case 2: *dest++ = value; // fall through <------ absence is not detected case 1: *dest = value; } return; } // ... This specialisation ends up not being instantiated, but I'd expect a warning from a full specialisation nonetheless. Hmm. If I change from specialisation to overloading (ie. to a non-template), the switch still doesn't trigger. I thought the warning was generated by the front-end, but it seems it'd generated by the backend instead, after dead code elimination...?