This change to an early C++2a feature was just approved (P1612R1).
* include/std/bit (endian): Move definition here as per P1612R1. * include/std/type_traits (endian): Remove definition from here. * testsuite/20_util/endian/1.cc: Rename to ... * testsuite/26_numerics/endian/1.cc: ... here. Adjust header. Tested x86_64-linux, committed to trunk. I'll also backport to gcc-9.
commit 175a348ce63ad554228e6b58f4fbc6ca559b66cc Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Thu Jul 25 20:30:25 2019 +0000 Relocate std::endian from <type_traits> to <bit> This change to an early C++2a feature was just approved (P1612R1). * include/std/bit (endian): Move definition here as per P1612R1. * include/std/type_traits (endian): Remove definition from here. * testsuite/20_util/endian/1.cc: Rename to ... * testsuite/26_numerics/endian/1.cc: ... here. Adjust header. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@273816 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit index f17d2f1bd59..d57433c093a 100644 --- a/libstdc++-v3/include/std/bit +++ b/libstdc++-v3/include/std/bit @@ -315,6 +315,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION log2p1(_Tp __x) noexcept { return std::__log2p1(__x); } + /// Byte order + enum class endian + { + little = __ORDER_LITTLE_ENDIAN__, + big = __ORDER_BIG_ENDIAN__, + native = __BYTE_ORDER__ + }; #endif // C++2a _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index d8ed1ce120d..9428dadc9d7 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -3226,14 +3226,6 @@ template <typename _From, typename _To> #endif // C++17 #if __cplusplus > 201703L - /// Byte order - enum class endian - { - little = __ORDER_LITTLE_ENDIAN__, - big = __ORDER_BIG_ENDIAN__, - native = __BYTE_ORDER__ - }; - /// Remove references and cv-qualifiers. template<typename _Tp> struct remove_cvref diff --git a/libstdc++-v3/testsuite/20_util/endian/1.cc b/libstdc++-v3/testsuite/26_numerics/endian/1.cc similarity index 98% rename from libstdc++-v3/testsuite/20_util/endian/1.cc rename to libstdc++-v3/testsuite/26_numerics/endian/1.cc +++ b/libstdc++-v3/testsuite/26_numerics/endian/1.cc @@ -18,7 +18,7 @@ // { dg-options "-std=gnu++2a" } // { dg-do compile { target c++2a } } -#include <type_traits> +#include <bit> static_assert( std::is_enum_v<std::endian> ); static_assert( std::endian::little != std::endian::big );