https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77955

--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Another issue:

markus@x4 /tmp % cat fall.c
void bar(int);

template <typename T> void foo(int i, bool bo) {
  switch (i) {
  case 1:
    if (!bo)
      break;
  // Fall through.
  case 2:
    bar(2);
  default:
    break;
  }
}

template void foo<int>(int, bool);
template void foo<void*>(int, bool);

markus@x4 /tmp % g++ -Wimplicit-fallthrough=1 -c fall.c
fall.c: In function ‘void foo(int, bool) [with T = int]’:
fall.c:6:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if (!bo)
     ^~
fall.c:9:3: note: here
   case 2:
   ^~~~
fall.c: In function ‘void foo(int, bool) [with T = void*]’:
fall.c:6:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if (!bo)
     ^~
fall.c:9:3: note: here
   case 2:
   ^~~~

Reply via email to