[PATCH] Define __cpp_lib_is_constant_evaluated

Jakub Jelinek jakub@redhat.com
Fri Jan 11 15:51:00 GMT 2019


Hi!

Seems __cpp_lib_is_constant_evaluated should be defined to 201811L
if std::is_constant_evaluated() is implemented.

Ok for trunk?

2019-01-11  Jakub Jelinek  <jakub@redhat.com>

	* include/std/type_traits (__cpp_lib_is_constant_evaluated): Define.
	* include/std/version (__cpp_lib_is_constant_evaluated): Define.

--- libstdc++-v3/include/std/type_traits.jj	2019-01-01 12:45:50.842546655 +0100
+++ libstdc++-v3/include/std/type_traits	2019-01-11 16:44:39.546916488 +0100
@@ -3030,6 +3030,9 @@ template <typename _From, typename _To>
     using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
 
 #ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
+
+#define __cpp_lib_is_constant_evaluated 201811L 	
+
   constexpr inline bool
   is_constant_evaluated() noexcept
   { return __builtin_is_constant_evaluated(); }
--- libstdc++-v3/include/std/version.jj	2019-01-10 16:42:18.081062695 +0100
+++ libstdc++-v3/include/std/version	2019-01-11 16:48:35.944119391 +0100
@@ -142,6 +142,9 @@
 
 #if __cplusplus > 201703L
 // c++2a
+#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
+# define __cpp_lib_is_constant_evaluated 201811L
+#endif
 #define __cpp_lib_list_remove_return_type 201806L
 #endif // C++2a
 #endif // C++17

	Jakub



More information about the Libstdc++ mailing list