The C++1z/C++17 draft standard introduces a [[fallthrough]] attribute to explicitly document that fall-through behavior is intended in a switch-case block. This works in conjunction with G++'s -Wimplicit-fallthrough option, which gives a warning about potentially unintended fall-through behaviors. The [[fallthrough]] attribute is required to be applied to an empty statement (see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0188r1.pdf), and therefore requires a terminating semicolon. However, forgetting that semicolon is a common error. With the following code: #include <iostream> int main() { switch (0) { case 0: std::cout << "a\n"; [[fallthrough]] case 1: std::cout << "b\n"; break; } } G++ (7.1 and the current trunk of 8.0) issues the following warning: warning: this statement may fall through [-Wimplicit-fallthrough=] std::cout << "a\n"; ~~~~~~~~~~^~~~~~~~ This is less helpful than it could be. The current Clang trunk provides a substantially more helpful error message in this case: error: fallthrough attribute is only allowed on empty statements [[fallthrough]] ^ note: did you forget ';'? [[fallthrough]] ^ ; It would be nice to have something similar in G++.
GCC 9.1 has been released.
GCC 9.2 has been released.
GCC 9.3.0 has been released, adjusting target milestone.
GCC 9.4 is being released, retargeting bugs to GCC 9.5.