https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79301
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Anders Kaseorg from comment #3) > (In reply to Jakub Jelinek from comment #2) > > I think right now you need to use > > #ifdef __has_cpp_attribute > > # if __has_cpp_attribute(fallthrough) >= __cplusplus > > [[fallthrough]]; > > Surely you intended* #if __has_cpp_attribute(fallthrough) && __cplusplus >= > __has_cpp_attribute(fallthrough)? No, I meant what I wrote. __has_cpp_attribute(fallthrough) gives you the year + month when the feature has been introduced, and you then use it only if it has been introduced before or at the same time as the C++ version (__cplusplus gives you again year + month) you are compilining for. Once C++17 will be released, __cplusplus will be 201705 or whatever similar. Or just # if __cplusplus > 201402 && __has_cpp_attribute(fallthrough) That said, I think e.g. for maybe_unused or nodiscard attributes we don't complain with -pedantic about those attributes used in C++14 code, so either we should do that as well, or we shouldn't do that for fallthrough either. Jason?