This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
GCC 7.1 Fallthrough Warning Question
- From: Josh <snapcore at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 26 Sep 2017 12:54:28 -0700
- Subject: GCC 7.1 Fallthrough Warning Question
- Authentication-results: sourceware.org; auth=none
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