https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79301

--- Comment #3 from Anders Kaseorg <andersk at mit dot edu> ---
(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)?

But neither version helps in current g++-7, where __cplusplus is 201402 (C++14)
or 201500 (C++17), while __has_cpp_attribute(fallthrough) is greater than both:
201603.

(* Yes, this is confusing, and I would suggest that this confusion is already a
good argument for __has_cpp_attribute doing the language standard comparison
itself rather than foisting it off on the programmer.  That is,
__has_cpp_attribute(fallthrough) should return 201500 (C++17 and higher) or 0
(C++14 and lower))

Reply via email to