ITADN

realm-core tries to specialize forbidden templates

#8093OpenBillyONeal 创建于 2026-02-24
B
BillyONealcommented
https://github.com/realm/realm-core/blob/86733dc38af48ea871a4ab832efd85e0aeaaab15/src/external/s2/util/math/vector3-inl.h#L422-L425 This attempt to specialize `std::is_pod` is forbidden by https://eel.is/c++draft/type.traits#meta.rqmts-4 and now causes compiler errors on recent versions of clang: ```console /android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi28 --sysroot=/android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DREALM_DEBUG=1 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D_POSIX_C_SOURCE=200112L -I/vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external -I/vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src -I/vcpkg/buildtrees/realm-core/arm-neon-android-dbg/src -isystem /vcpkg/installed/arm-neon-android/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -frtti -fexceptions -fPIC -fno-limit-debug-info -std=c++17 -fPIC -fvisibility=hidden -Wall -Wextra -Wempty-body -Wparentheses -Wunknown-pragmas -Wunreachable-code -Wunused-parameter -Wno-missing-field-initializers -Wno-uninitialized -Wno-psabi -Wpartial-availability -Wno-redundant-move -fdiagnostics-color -fdata-sections -ffunction-sections -fomit-frame-pointer -fsigned-char -fstrict-aliasing -funwind-tables -no-canonical-prefixes -pthread -MD -MT src/realm/CMakeFiles/Storage.dir/geospatial.cpp.o -MF src/realm/CMakeFiles/Storage.dir/geospatial.cpp.o.d -o src/realm/CMakeFiles/Storage.dir/geospatial.cpp.o -c /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/realm/geospatial.cpp In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/realm/geospatial.cpp:37: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2cap.h:8: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s1angle.h:15: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2.h:29: /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/util/math/vector3-inl.h:425:1: error: 'is_pod' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization] 425 | PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT(Vector3); | ^ /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/base/macros.h:181:30: note: expanded from macro 'PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT' 181 | template <typename T> struct is_pod<TemplateName<T> > : std::is_trivial<T> { }; \ | ^ /android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__type_traits/is_pod.h:22:29: note: marked 'no_specializations' here 22 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant<bool, __is_pod(_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")]] | ^ In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/realm/geospatial.cpp:37: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2cap.h:8: /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s1angle.h:101:1: error: 'is_pod' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization] 101 | DECLARE_POD(S1Angle); | ^ /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/base/macros.h:165:19: note: expanded from macro 'DECLARE_POD' 165 | template<> struct is_pod<TypeName> : true_type { }; \ | ^ /android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__type_traits/is_pod.h:22:29: note: marked 'no_specializations' here 22 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant<bool, __is_pod(_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")]] | ^ In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/realm/geospatial.cpp:38: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2latlng.h:13: /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/util/math/vector2-inl.h:358:1: error: 'is_pod' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization] 358 | PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT(Vector2); | ^ /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/base/macros.h:181:30: note: expanded from macro 'PROPAGATE_POD_FROM_TEMPLATE_ARGUMENT' 181 | template <typename T> struct is_pod<TemplateName<T> > : std::is_trivial<T> { }; \ | ^ /android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__type_traits/is_pod.h:22:29: note: marked 'no_specializations' here 22 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant<bool, __is_pod(_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")]] | ^ In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/realm/geospatial.cpp:38: /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2latlng.h:112:1: error: 'is_pod' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization] 112 | DECLARE_POD(S2LatLng); | ^ /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/base/macros.h:165:19: note: expanded from macro 'DECLARE_POD' 165 | template<> struct is_pod<TypeName> : true_type { }; \ | ^ /android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__type_traits/is_pod.h:22:29: note: marked 'no_specializations' here 22 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant<bool, __is_pod(_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")]] | ^ In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/realm/geospatial.cpp:39: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2polygon.h:19: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2loop.h:16: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2edgeindex.h:22: /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2cellid.h:318:1: error: 'is_pod' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization] 318 | DECLARE_POD(S2CellId); | ^ /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/base/macros.h:165:19: note: expanded from macro 'DECLARE_POD' 165 | template<> struct is_pod<TypeName> : true_type { }; \ | ^ /android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__type_traits/is_pod.h:22:29: note: marked 'no_specializations' here 22 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant<bool, __is_pod(_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")]] | ^ In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/realm/geospatial.cpp:39: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2polygon.h:19: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2loop.h:16: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2edgeindex.h:23: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2edgeutil.h:9: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2latlngrect.h:15: /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/r1interval.h:180:1: error: 'is_pod' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization] 180 | DECLARE_POD(R1Interval); | ^ /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/base/macros.h:165:19: note: expanded from macro 'DECLARE_POD' 165 | template<> struct is_pod<TypeName> : true_type { }; \ | ^ /android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__type_traits/is_pod.h:22:29: note: marked 'no_specializations' here 22 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant<bool, __is_pod(_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")]] | ^ In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/realm/geospatial.cpp:39: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2polygon.h:19: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2loop.h:16: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2edgeindex.h:23: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2edgeutil.h:9: In file included from /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s2latlngrect.h:16: /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/s1interval.h:189:1: error: 'is_pod' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization] 189 | DECLARE_POD(S1Interval); | ^ /vcpkg/buildtrees/realm-core/src/v14.14.0-d68af96835.clean/src/external/s2/base/macros.h:165:19: note: expanded from macro 'DECLARE_POD' 165 | template<> struct is_pod<TypeName> : true_type { }; \ | ^ /android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__type_traits/is_pod.h:22:29: note: marked 'no_specializations' here 22 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant<bool, __is_pod(_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")]] | ^ 7 errors generated. ```
4 条评论