[PATCH] Update value of __cpp_lib_chrono feature-test macro
Jonathan Wakely
jwakely@redhat.com
Fri Oct 20 21:06:00 GMT 2017
Dinka Ranns contributed this feature back in February, but the SD-6
feature-test macro now has a new value to indicate support for this,
so let's update it.
* include/std/chrono (__cpp_lib_chrono): Update macro value to
indicate support for P0505R0.
* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Check
for updated macro.
Tested powerpc64le-linux, committed to trunk and gcc-7-branch.
-------------- next part --------------
commit 8a7bf24c72d1373571d8f61d8078c874425c8256
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Oct 20 19:53:24 2017 +0100
Update value of __cpp_lib_chrono feature-test macro
* include/std/chrono (__cpp_lib_chrono): Update macro value to
indicate support for P0505R0.
* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Check
for updated macro.
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index fc058fcd8d8..9491508e637 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -214,8 +214,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
treat_as_floating_point<_Rep>::value;
#endif // C++17
-#if __cplusplus > 201402L
-# define __cpp_lib_chrono 201510
+#if __cplusplus >= 201703L
+# define __cpp_lib_chrono 201611
template<typename _ToDur, typename _Rep, typename _Period>
constexpr __enable_if_is_duration<_ToDur>
diff --git a/libstdc++-v3/testsuite/20_util/duration/arithmetic/constexpr_c++17.cc b/libstdc++-v3/testsuite/20_util/duration/arithmetic/constexpr_c++17.cc
index 438d50afddf..0ba1b8cc706 100644
--- a/libstdc++-v3/testsuite/20_util/duration/arithmetic/constexpr_c++17.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/arithmetic/constexpr_c++17.cc
@@ -20,6 +20,13 @@
#include <chrono>
#include <testsuite_common_types.h>
+
+#ifndef __cpp_lib_chrono
+# error "Feature-test macro for constexpr <chrono> missing"
+#elif __cpp_lib_chrono != 201611
+# error "Feature-test macro for constexpr <chrono> has wrong value"
+#endif
+
constexpr auto test_operators()
{
std::chrono::nanoseconds d1 { 1 };
More information about the Libstdc++
mailing list