This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/79433] __has_include(<new header>) is true but #include <new header> gives #error when -std=old


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

--- Comment #23 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No, because after discussion with the feature-test study group I don't want to
rely on GCC-specific magic. Instead I think it would be better for headers to
do:

#if __cplusplus >= 201402L
#define __cpp_lib_some_feature YYYYMM
...
#endif

That would mean including the header doesn't give an error, but you need to
test for both the header and a feature-test macro to know if the feature is
really available. i.e. existence of a header doesn't imply anything except that
the header can be included without error.

This needs a proposal to the study group and a change to SD-6 (currently
detection of many features only uses __has_include and there's no macro that
can be tested) and then changes to GCC to remove the #error directives (so we
allow inclusion, but define nothing when included with the wrong -std mode).

None of that has been decided on yet, so it's not possible to say if some
hypothetical idea would be backported to gcc-7-branch. There's nothing to
backport yet.

(N.B. C++14 added one new header, <shared_mutex>)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]