You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I get error with consteval function apply while using boost::pfr::names_as_array:
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:112:20:
error: constexpr variable 'fn' must be initialized by a constant expression
constexpr auto fn = skip.apply(sv);
Actually, I found the same issue in fmt, but none of the fixes didn't help:
Using libc++ instead of libstdc++.
Setting set(CMAKE_CXX_STANDARD 17) instead of set(CMAKE_CXX_STANDARD 20).
Plenty of other CMake tricky fixes.
I'm using boost 1.85.0.
Error occurs on boost 1.84.0 too.
Thanks for any help or advice!
In file included from /data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name.hpp:23:
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:112:20: error: constexpr variable 'fn' must be initialized by a constant expression
constexpr auto fn = skip.apply(sv);
^ ~~~~~~~~~~~~~~
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:180:20: note: in instantiation of function template specialization 'boost::pfr::detail::name_of_field_impl<..., {&do_not_use_PFR_with_local_types.value.timestamp}>' requested here
return detail::name_of_field_impl<MsvcWorkaround, ptr>();
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:188:54: note: in instantiation of function template specialization 'boost::pfr::detail::name_of_field<..., {&do_not_use_PFR_with_local_types.value.timestamp}>' requested here
inline constexpr auto stored_name_of_field = detail::name_of_field<T,
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:200:73: note: in instantiation of variable template specialization 'boost::pfr::detail::stored_name_of_field' requested here
return detail::sequence_tuple::make_sequence_tuple(std::string_view{stored_name_of_field<T, I>.data()}...);
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:236:20: note: in instantiation of function template specialization 'boost::pfr::detail::tie_as_names_tuple_impl<myclass::Options, 0UL, 1UL>' requested here
return detail::tie_as_names_tuple_impl<T>(detail::make_index_sequence<detail::fields_count<T>()>{});
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/core_name.hpp:79:17: note: in instantiation of function template specialization 'boost::pfr::detail::tie_as_names_tuple<myclass::Options>' requested here
detail::tie_as_names_tuple<T>(),
^
/...my_project/: note: in instantiation of function template specialization 'boost::pfr::names_as_array<myclass::Options>' requested here
auto names = boost::pfr::names_as_array<Options>();
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:112:30: note: non-constexpr function 'apply' cannot be used in a constant expression
constexpr auto fn = skip.apply(sv);
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:35:32: note: declared here
consteval std::string_view apply(std::string_view sv) const noexcept {
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:114:9: error: static_assert expression is not an integral constant expression
!fn.empty(),
^~~~~~~~~~~
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:114:13: note: initializer of 'fn' is not a constant expression
!fn.empty(),
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:112:20: note: declared here
constexpr auto fn = skip.apply(sv);
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:120:33: error: non-type template argument is not a constant expression
auto res = std::array<char, fn.size()+1>{};
^~~~~~~~~~~
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:120:36: note: initializer of 'fn' is not a constant expression
auto res = std::array<char, fn.size()+1>{};
^
/data2/eipulatov/.conan/data/boost/1.85.0/_/_/package/0458049ba3cdb8489beabfab45dd835a78ef307b/include/boost/pfr/detail/core_name20_static.hpp:112:20: note: declared here
constexpr auto fn = skip.apply(sv);
The text was updated successfully, but these errors were encountered:
Problem
Hello!
I get error with consteval function apply while using
boost::pfr::names_as_array
:Actually, I found the same issue in fmt, but none of the fixes didn't help:
libc++
instead oflibstdc++
.set(CMAKE_CXX_STANDARD 17)
instead ofset(CMAKE_CXX_STANDARD 20)
.I'm using
boost 1.85.0
.Error occurs on
boost 1.84.0
too.Thanks for any help or advice!
Environment
I'm using
Full text of error:
The text was updated successfully, but these errors were encountered: