glaze icon indicating copy to clipboard operation
glaze copied to clipboard

API test failure under GCC 15

Open lexpierce opened this issue 11 months ago • 1 comments

It appears that something has changed in the GCC 15 standard C++ headers, and api_test fails to compile:

[  5%] Building CXX object tests/api_test/CMakeFiles/api_test.dir/api_test.cpp.o
In file included from /usr/include/c++/15/bits/unordered_map.h:33,
                 from /usr/include/c++/15/unordered_map:43,
                 from /usr/include/c++/15/functional:65,
                 from /home/lexpierce/Source/hypr/glaze/include/glaze/api/api.hpp:6,
                 from /home/lexpierce/Source/hypr/glaze/include/glaze/api/impl.hpp:6,
                 from /home/lexpierce/Source/hypr/glaze/tests/api_test/api_test.cpp:7:
/usr/include/c++/15/bits/hashtable.h: In instantiation of ‘class std::_Hashtable<std::vector<std::__cxx11::basic_string<char> >, std::vector<std::__cxx11::basic_string<char> >, std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::__detail::_Identity, std::equal_to<std::vector<std::__cxx11::basic_string<char> > >, std::hash<std::vector<std::__cxx11::basic_string<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >’:
/usr/include/c++/15/bits/unordered_set.h:110:18:   required from ‘class std::unordered_set<std::vector<std::__cxx11::basic_string<char> > >’
  110 |       _Hashtable _M_h;
      |                  ^~~~
/home/lexpierce/Source/hypr/glaze/include/glaze/core/meta.hpp:226:45:   required from ‘constexpr const std::string_view glz::name_v<std::unordered_set<std::vector<std::__cxx11::basic_string<char> > > >’
  226 |          if constexpr (requires { T::glaze::name; }) {
      |                                             ^~~~
/home/lexpierce/Source/hypr/glaze/tests/api_test/api_test.cpp:180:36:   required from here
  180 |          std::string_view u = glz::name_v<std::unordered_set<std::vector<std::string>>>;
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/15/bits/hashtable.h:210:51: error: static assertion failed: hash function must be copy constructible
  210 |       static_assert(is_copy_constructible<_Hash>::value,
      |                                                   ^~~~~
/usr/include/c++/15/bits/hashtable.h:210:51: note: ‘std::integral_constant<bool, false>::value’ evaluates to false
gmake[2]: *** [tests/api_test/CMakeFiles/api_test.dir/build.make:79: tests/api_test/CMakeFiles/api_test.dir/api_test.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1778: tests/api_test/CMakeFiles/api_test.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2

I am pointing the finger at GCC 15 as I knpw the move to c23 from c17 broke a few things on the C compiler side.

lexpierce avatar Apr 15 '25 18:04 lexpierce

Thanks for reporting this! I haven't yet tested GCC 15 with Glaze, but I've been looking forward to its release. Will try to look into this soon.

stephenberry avatar Apr 15 '25 19:04 stephenberry