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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #5)
> AFAIU, it will be welcome if someone implements it.

I'm not sure about that. As Marc pointed out in comment 1, the C++ committee's
recommendation is to test for feature test macros being defined, not use the
non-standard __has_feature extension. So the correct way to check for C++11
attributes would be:

  #if __cpp_attributes
  ...
  #endif

If the compiler defines that macro then it means it supports the feature. This
works perfectly without needing __has_feature.

N.B. the related __has_include extension provides functionality that can't be
done with just macros, and it is now part of C++17 (see http://wg21.link/p0061)
and is supported by GCC since version 5.1, as is the __has_cpp_attribute
described by SD-6.

I see no need to add __has_feature given that it contradicts the
recommendations of the C++ committee, and that GCC already defines the
recommended feature test macros that can be used without __has_feature.

Reply via email to