GCC 7.1 Fallthrough Warning Question

Josh snapcore@gmail.com
Tue Sep 26 19:54:00 GMT 2017


For gcc 7.1.1, I noticed the following will give a warning ("warning:
this statement may fall through") if you have -Wall on:

switch (Z) {
  case X: {
     break;
  }
  // fallsthrough
  default: {
    //..some code
  }
}

but removing the braces around the default block fixes it:

switch (Z) {
  case X: {
     break;
  }
  // fallsthrough
  default:
    //..some code
}

Is this intended or a possible bug?

-Josh



More information about the Gcc-help mailing list