In the following piece of code, I use the standard [[fallthrough]]
attribute from C++1z to document that a fallthrough is desired:
#include <iostream>
int main() {
switch (0) {
case 0:
std::cout << "a\n";
[[fallthrough]]
case 1:
std::cout << "b\n";
break;
}
}
With GCC 7.1, the code compiles without an error. However, the compiler still warns me about a fallthrough:
warning: this statement may fall through [-Wimplicit-fallthrough=]
std::cout << "a\n";
~~~~~~~~~~^~~~~~~~
Why?