Skip to content

float16_t.hpp tries to specialize standard library templates forbidden by the Standard #653

Description

@BillyONeal

namespace std
{
template <>
struct is_floating_point<half_float::half> : std::true_type
{};
// Looks like some compiler have a definition of
// is_floating_point_v independent from is_floating_point ...
template <>
inline constexpr bool is_floating_point_v<half_float::half> = true;
template <>
struct is_scalar<half_float::half> : std::true_type
{};
template <>
inline constexpr bool is_scalar_v<half_float::half> = true;
template <>
struct is_signed<half_float::half> : std::true_type
{};
template <>
inline constexpr bool is_signed_v<half_float::half> = true;
}
tries to specialize standard type traits which is forbidden. Example from an updated clang:

In file included from /mnt/vcpkg-ci/b/arcticdb-sparrow/src/2.3.0-01921c906f.clean/src/union_array.cpp:15:
In file included from /mnt/vcpkg-ci/b/arcticdb-sparrow/src/2.3.0-01921c906f.clean/include/sparrow/union_array.hpp:20:
In file included from /mnt/vcpkg-ci/b/arcticdb-sparrow/src/2.3.0-01921c906f.clean/include/sparrow/array_api.hpp:21:
In file included from /mnt/vcpkg-ci/b/arcticdb-sparrow/src/2.3.0-01921c906f.clean/include/sparrow/layout/array_access.hpp:17:
In file included from /mnt/vcpkg-ci/b/arcticdb-sparrow/src/2.3.0-01921c906f.clean/include/sparrow/arrow_interface/arrow_array_schema_proxy.hpp:26:
In file included from /mnt/vcpkg-ci/b/arcticdb-sparrow/src/2.3.0-01921c906f.clean/include/sparrow/arrow_interface/arrow_array_schema_info_utils.hpp:18:
In file included from /mnt/vcpkg-ci/b/arcticdb-sparrow/src/2.3.0-01921c906f.clean/include/sparrow/types/data_type.hpp:79:
/mnt/vcpkg-ci/b/arcticdb-sparrow/src/2.3.0-01921c906f.clean/include/sparrow/details/3rdparty/float16_t.hpp:258:27: error: 'is_signed_v' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization]
  258 |     inline constexpr bool is_signed_v<half_float::half> = true;
      |                           ^
/android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__type_traits/is_signed.h:30:1: note: marked 'no_specializations' here
   30 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_signed_v = __is_signed(_Tp);
      | ^
/android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__config:1177:9: note: expanded from macro '_LIBCPP_NO_SPECIALIZATIONS'
 1177 |       [[_Clang::__no_specializations__("Users are not allowed to specialize this standard library entity")]]
      |         ^

See https://eel.is/c++draft/type.traits#meta.rqmts-4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions