This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC 7.1 Fallthrough Warning Question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]