Skip to content
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

combine_latest fails build with MSVC 19.34.31935.0 when C++ standard is set to 17 #596

Open
juhanisimola-yousician opened this issue Dec 9, 2022 · 3 comments

Comments

@juhanisimola-yousician
Copy link

juhanisimola-yousician commented Dec 9, 2022

Reproduction steps:

  • Install latest MSVC build tools
  • Generate project with cmake -DCMAKE_CXX_STANDARD=17 -DRXCPP_DISABLE_TESTS_AND_EXAMPLES=0
  • Build

The build fails with long, long error message starting with

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\utility(491,62): error C2027: use  of undefined type 'std::tuple_size<_Ty>' [Z:\work\RxCpp\projects\CMake\cmake-build-vs-std17\test\rxcpp_test_combine_latest.vcxpro j]
          with
          [
              _Ty=rxcpp::util::detail::surely
          ]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\utility(491,45): message : see de claration of 'std::tuple_size<_Ty>' [Z:\work\RxCpp\projects\CMake\cmake-build-vs-std17\test\rxcpp_test_combine_latest.vcxproj]
          with
          [
              _Ty=rxcpp::util::detail::surely
          ]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\tuple(886,29): message : see refe rence to variable template 'const size_t tuple_size_v<rxcpp::util::detail::surely>' being compiled [Z:\work\RxCpp\projects\CMake\c make-build-vs-std17\test\rxcpp_test_combine_latest.vcxproj]
Z:\work\RxCpp\Rx\v2\src\rxcpp\rx-observer.hpp(119,1): message : see reference to function template instantiation 'auto rxcpp::oper ators::detail::combine_latest<rxcpp::identity_one_worker,ResolvedSelector,rxcpp::observable<copy_verifier,rxcpp::dynamic_observabl e<T>>,rxcpp::observable<int,rxcpp::sources::detail::iterate<std::array<int,1>,rxcpp::identity_one_worker>>>::subscribe_one::<lambd a_bcf9f84f11f0b5575b8d9322f6074035>::operator ()<copy_verifier>(copy_verifier &&) const' being compiled [Z:\work\RxCpp\projects\CM ake\cmake-build-vs-std17\test\rxcpp_test_combine_latest.vcxproj]
          with
          [
              ResolvedSelector=C_A_T_C_H_T_E_S_T_185::<lambda_d6e91046af7606d56dd145e6479e9d93>,
              T=copy_verifier
          ]
Z:\work\RxCpp\Rx\v2\src\rxcpp/operators/rx-combine_latest.hpp(136,1): message : see reference to class template instantiation 'rxc pp::detail::is_on_next_of<source_value_type,rxcpp::operators::detail::combine_latest<rxcpp::identity_one_worker,ResolvedSelector,r xcpp::observable<copy_verifier,rxcpp::dynamic_observable<T>>,rxcpp::observable<int,rxcpp::sources::detail::iterate<std::array<int, 1>,rxcpp::identity_one_worker>>>::subscribe_one::<lambda_bcf9f84f11f0b5575b8d9322f6074035>>' being compiled [Z:\work\RxCpp\project s\CMake\cmake-build-vs-std17\test\rxcpp_test_combine_latest.vcxproj]
          with
          [
              ResolvedSelector=C_A_T_C_H_T_E_S_T_185::<lambda_d6e91046af7606d56dd145e6479e9d93>,
              T=copy_verifier
          ]
Z:\work\RxCpp\Rx\v2\src\rxcpp\rx-subscriber.hpp(786,6): message : see reference to function template instantiation 'std::enable_if <rxcpp::detail::is_on_next_of<T,Observer>::value&&rxcpp::detail::is_on_error<OnError>::value&&rxcpp::detail::is_on_completed<OnCom pleted>::value,rxcpp::subscriber<T,rxcpp::observer<T,rxcpp::detail::stateless_observer_tag,OnNext,OnError,OnCompleted>>>::type rxc pp::make_subscriber(const rxcpp::subscriber<OtherT,OtherObserver> &,const rxcpp::composite_subscription &,const OnNext &,const OnE rror &,const OnCompleted &)' being compiled [Z:\work\RxCpp\projects\CMake\cmake-build-vs-std17\test\rxcpp_test_combine_latest.vcxp roj]

Build is successful using C++ standards 11 and 14, but not 17. There are other errors when attempting to build with Clang, but this part can be successfully built.

@xiaoxiaok
Copy link

Add util to apply in surely may fix this problem just as following

template<class... T>
inline auto surely(const std::tuple<T...>& tpl)
    -> decltype(util::apply(tpl, detail::surely())) {
    return      util::apply(tpl, detail::surely());
}

@juhanisimola-yousician
Copy link
Author

Thanks, that worked.

@juhanisimola-yousician
Copy link
Author

I fixed this and some Clang issues at https://github.com/YousicianGit/RxCpp/pull/1/files

JamesPerlman added a commit to JamesPerlman/TurboNeRF that referenced this issue Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants