[Bug c++/79433] New: __has_include reports wrong result headers that #error on __cplusplus

marc.mutz at kdab dot com gcc-bugzilla@gcc.gnu.org
Wed Feb 8 19:21:00 GMT 2017


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

            Bug ID: 79433
           Summary: __has_include reports wrong result headers that #error
                    on __cplusplus
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marc.mutz at kdab dot com
  Target Milestone: ---

Code that attempts to detect, say, string_view support by
__has_include(<string_view>) or __has_include(<experimental/string_view>) and
then attempts to #include those headers is greeted with an #error that these
headers require C++17 and C++14, resp.

Since there's no SG-10 SD-6 feature test macro for string_view, this means that
no portable way of detecting string_view support is possible.

Expected behaviour: __has_include should behave consistent with the header's
#error mechanism.


More information about the Gcc-bugs mailing list