https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126365
Bug ID: 126365
Summary: In correct values for feature test macros when using
<version>
Product: gcc
Version: 16.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: lcarreon at bigpond dot net.au
Target Milestone: ---
It appears that when -std=c++23 is set for the compiler, several feature test
macros have the wrong values when using "#include <version>". For example,
__cpp_lib_chrono has the value 201907. According to the C++ compiler support
tables at isocpp.org, gcc has P2592R3 implemented in gcc 16 therefore the
expected value for __cpp_lib_chrono is 202306 as per SD-Feature Test standing
document. I have looked in bits/version.h and I think the reason why is
because of this line:
# if (__cplusplus > 202302L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED
Imo, the ">" sign should be ">=" because the value of __cplusplus when
-std=c++23 is 202302 thus the above test would be false instead of true.
It seems several C++23 tests in this header file are all incorrect because of
">" instead of ">=".