-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compile error on requires to_view #220
Comments
Hi @zhuoqiang , what error message do you get when you do this? |
In file included from /rfl/internal/get_ith_field_from_fake_object.hpp:13,
from /rfl/internal/get_field_names.hpp:12,
from /rfl/field_names_t.hpp:7,
from /rfl/internal/to_ptr_named_tuple.hpp:9,
from /rfl/to_view.hpp:8,
from main.cpp:1:
/rfl/internal/num_fields.hpp: In instantiation of 'static consteval std::size_t rfl::internal::CountFieldsHelper<T>::count_max_args_in_agg() [with long unsigned int n = 33; T = std::__cxx11::basic_string<char>; std::size_t = long unsigned int]':
/rfl/internal/num_fields.hpp:107:42: required from 'static consteval std::size_t rfl::internal::CountFieldsHelper<T>::count_fields() [with T = std::__cxx11::basic_string<char>; std::size_t = long unsigned int]'
107 | return count_max_args_in_agg<n + 1>();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/internal/num_fields.hpp:208:70: required from 'constexpr const std::size_t rfl::internal::num_fields<std::__cxx11::basic_string<char> >'
208 | constexpr std::size_t num_fields = CountFieldsHelper<T>::count_fields();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/internal/bind_to_tuple.hpp:551:28: required from 'auto rfl::internal::tuple_view(T&) [with T = std::__cxx11::basic_string<char>]'
551 | return tuple_view_helper<num_fields<T>>::tuple_view(t);
| ^~~~~~~~~~~~
/rfl/internal/bind_to_tuple.hpp:556:25: required from 'auto rfl::internal::bind_to_tuple(T&, const F&) [with T = std::__cxx11::basic_string<char>; F = to_ptr_tuple<std::__cxx11::basic_string<char> >(std::__cxx11::basic_string<char>&)::<lambda(auto:362*)>]'
556 | auto view = tuple_view(_t);
| ~~~~~~~~~~^~~~
/rfl/internal/to_ptr_tuple.hpp:18:25: required from 'auto rfl::internal::to_ptr_tuple(T&) [with T = std::__cxx11::basic_string<char>]'
18 | return bind_to_tuple(_t, [](auto* _ptr) { return _ptr; });
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/rfl/internal/ptr_tuple_t.hpp:13:42: required by substitution of 'template<class T> using rfl::internal::ptr_tuple_t = decltype (rfl::internal::to_ptr_tuple(declval<T&>())) [with T = std::__cxx11::basic_string<char>]'
13 | using ptr_tuple_t = decltype(to_ptr_tuple(std::declval<T&>()));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/rfl/internal/has_fields.hpp:61:11: required from 'constexpr bool rfl::internal::has_fields() [with T = std::__cxx11::basic_string<char>]'
61 | using TupleType = ptr_tuple_t<T>;
| ^~~~~~~~~
/rfl/internal/to_ptr_named_tuple.hpp:61:51: required from 'auto rfl::internal::to_ptr_named_tuple(T&&) [with T = const std::__cxx11::basic_string<char>&]'
61 | if constexpr (has_fields<std::remove_cvref_t<T>>()) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/to_view.hpp:14:38: required from 'auto rfl::to_view(T&) [with T = const std::__cxx11::basic_string<char>]'
14 | return internal::to_ptr_named_tuple(_t);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
main.cpp:8:40: required from 'void FailedToCompile(const T&) [with T = std::__cxx11::basic_string<char>]'
8 | if constexpr (requires { rfl::to_view(t); }) {
| ~~~~~~~~~~~~^~~
main.cpp:14:18: required from here
14 | FailedToCompile(s);
| ~~~~~~~~~~~~~~~^~~
/rfl/internal/num_fields.hpp:184:63: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<1>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<2>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<3>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<4>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<5>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<6>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<7>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<8>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<9>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<10>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<11>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<12>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<13>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<14>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<15>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<16>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<17>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<18>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<19>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<20>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<21>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<22>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<23>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<24>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<25>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<26>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<27>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<28>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<29>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<30>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<31>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<32>()'
/rfl/internal/num_fields.hpp:103:21: error: static assertion failed
103 | static_assert(n <= static_cast<std::size_t>(sizeof(T)));
| ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/rfl/internal/num_fields.hpp:103:21: note: the comparison reduces to '(33 <= 32)'
/rfl/internal/num_fields.hpp: In instantiation of 'static consteval std::size_t rfl::internal::CountFieldsHelper<T>::count_max_args_in_agg() [with long unsigned int n = 34; T = std::__cxx11::basic_string<char>; std::size_t = long unsigned int]':
/rfl/internal/num_fields.hpp:107:42: required from 'static consteval std::size_t rfl::internal::CountFieldsHelper<T>::count_fields() [with T = std::__cxx11::basic_string<char>; std::size_t = long unsigned int]'
107 | return count_max_args_in_agg<n + 1>();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/internal/num_fields.hpp:208:70: required from 'constexpr const std::size_t rfl::internal::num_fields<std::__cxx11::basic_string<char> >'
208 | constexpr std::size_t num_fields = CountFieldsHelper<T>::count_fields();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/internal/bind_to_tuple.hpp:551:28: required from 'auto rfl::internal::tuple_view(T&) [with T = std::__cxx11::basic_string<char>]'
551 | return tuple_view_helper<num_fields<T>>::tuple_view(t);
| ^~~~~~~~~~~~
/rfl/internal/bind_to_tuple.hpp:556:25: required from 'auto rfl::internal::bind_to_tuple(T&, const F&) [with T = std::__cxx11::basic_string<char>; F = to_ptr_tuple<std::__cxx11::basic_string<char> >(std::__cxx11::basic_string<char>&)::<lambda(auto:362*)>]'
556 | auto view = tuple_view(_t);
| ~~~~~~~~~~^~~~
/rfl/internal/to_ptr_tuple.hpp:18:25: required from 'auto rfl::internal::to_ptr_tuple(T&) [with T = std::__cxx11::basic_string<char>]'
18 | return bind_to_tuple(_t, [](auto* _ptr) { return _ptr; });
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/rfl/internal/ptr_tuple_t.hpp:13:42: required by substitution of 'template<class T> using rfl::internal::ptr_tuple_t = decltype (rfl::internal::to_ptr_tuple(declval<T&>())) [with T = std::__cxx11::basic_string<char>]'
13 | using ptr_tuple_t = decltype(to_ptr_tuple(std::declval<T&>()));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/rfl/internal/has_fields.hpp:61:11: required from 'constexpr bool rfl::internal::has_fields() [with T = std::__cxx11::basic_string<char>]'
61 | using TupleType = ptr_tuple_t<T>;
| ^~~~~~~~~
/rfl/internal/to_ptr_named_tuple.hpp:61:51: required from 'auto rfl::internal::to_ptr_named_tuple(T&&) [with T = const std::__cxx11::basic_string<char>&]'
61 | if constexpr (has_fields<std::remove_cvref_t<T>>()) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/to_view.hpp:14:38: required from 'auto rfl::to_view(T&) [with T = const std::__cxx11::basic_string<char>]'
14 | return internal::to_ptr_named_tuple(_t);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
main.cpp:8:40: required from 'void FailedToCompile(const T&) [with T = std::__cxx11::basic_string<char>]'
8 | if constexpr (requires { rfl::to_view(t); }) {
| ~~~~~~~~~~~~^~~
main.cpp:14:18: required from here
14 | FailedToCompile(s);
| ~~~~~~~~~~~~~~~^~~
/rfl/internal/num_fields.hpp:184:63: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<1>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<2>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<3>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<4>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<5>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<6>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<7>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<8>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<9>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<10>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<11>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<12>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<13>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<14>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<15>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<16>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<17>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<18>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<19>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<20>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<21>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<22>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<23>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<24>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<25>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<26>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<27>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<28>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<29>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<30>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<31>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<32>()'
/rfl/internal/num_fields.hpp:107:42: in 'constexpr' expansion of 'rfl::internal::CountFieldsHelper<std::__cxx11::basic_string<char> >::count_max_args_in_agg<33>()'
/rfl/internal/num_fields.hpp:103:21: error: static assertion failed
103 | static_assert(n <= static_cast<std::size_t>(sizeof(T)));
| ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/rfl/internal/num_fields.hpp:103:21: note: the comparison reduces to '(34 <= 32)'
/rfl/internal/num_fields.hpp: In instantiation of 'static consteval std::size_t rfl::internal::CountFieldsHelper<T>::count_max_args_in_agg() [with long unsigned int n = 35; T = std::__cxx11::basic_string<char>; std::size_t = long unsigned int]':
/rfl/internal/num_fields.hpp:107:42: required from 'static consteval std::size_t rfl::internal::CountFieldsHelper<T>::count_fields() [with T = std::__cxx11::basic_string<char>; std::size_t = long unsigned int]'
107 | return count_max_args_in_agg<n + 1>();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/internal/num_fields.hpp:208:70: required from 'constexpr const std::size_t rfl::internal::num_fields<std::__cxx11::basic_string<char> >'
208 | constexpr std::size_t num_fields = CountFieldsHelper<T>::count_fields();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/internal/bind_to_tuple.hpp:551:28: required from 'auto rfl::internal::tuple_view(T&) [with T = std::__cxx11::basic_string<char>]'
551 | return tuple_view_helper<num_fields<T>>::tuple_view(t);
| ^~~~~~~~~~~~
/rfl/internal/bind_to_tuple.hpp:556:25: required from 'auto rfl::internal::bind_to_tuple(T&, const F&) [with T = std::__cxx11::basic_string<char>; F = to_ptr_tuple<std::__cxx11::basic_string<char> >(std::__cxx11::basic_string<char>&)::<lambda(auto:362*)>]'
556 | auto view = tuple_view(_t);
| ~~~~~~~~~~^~~~
/rfl/internal/to_ptr_tuple.hpp:18:25: required from 'auto rfl::internal::to_ptr_tuple(T&) [with T = std::__cxx11::basic_string<char>]'
18 | return bind_to_tuple(_t, [](auto* _ptr) { return _ptr; });
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/rfl/internal/ptr_tuple_t.hpp:13:42: required by substitution of 'template<class T> using rfl::internal::ptr_tuple_t = decltype (rfl::internal::to_ptr_tuple(declval<T&>())) [with T = std::__cxx11::basic_string<char>]'
13 | using ptr_tuple_t = decltype(to_ptr_tuple(std::declval<T&>()));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/rfl/internal/has_fields.hpp:61:11: required from 'constexpr bool rfl::internal::has_fields() [with T = std::__cxx11::basic_string<char>]'
61 | using TupleType = ptr_tuple_t<T>;
| ^~~~~~~~~
/rfl/internal/to_ptr_named_tuple.hpp:61:51: required from 'auto rfl::internal::to_ptr_named_tuple(T&&) [with T = const std::__cxx11::basic_string<char>&]'
61 | if constexpr (has_fields<std::remove_cvref_t<T>>()) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/rfl/to_view.hpp:14:38: required from 'auto rfl::to_view(T&) [with T = const std::__cxx11::basic_string<char>]'
14 | return internal::to_ptr_named_tuple(_t);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
main.cpp:8:40: required from 'void FailedToCompile(const T&) [with T = std::__cxx11::basic_string<char>]'
8 | if constexpr (requires { rfl::to_view(t); }) {
| ~~~~~~~~~~~~^~~
main.cpp:14:18: required from here
14 | FailedToCompile(s);
| ~~~~~~~~~~~~~~~^~~ |
Interesting...this apparently happens when you try to insert a string. I think this could be resolved with a well-placed constexpr if. I will take a look. |
no need to do actual actions, the following constexpr check is enough to reproduce the compile error: if constexpr (requires { rfl::to_view(t); }) {
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to check if
rfl::to_view()
can be applied to a variable of typeT
, but the following code fails to compile:As a workaround, I have to use
std::is_aggregate_v<T>
for the check instead.Would it be possible to add a concept constraint requiring
rfl::to_view
to only be applicable whenT
satisfiesstd::is_aggregate_v<T>
? That way, theif constexpr (requires { rfl::to_view(t); })
condition would work as expected.The text was updated successfully, but these errors were encountered: