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

[rttr] rttr provided with vcpkg cannot be build with C++20 #29794

Closed
pozemka opened this issue Feb 22, 2023 · 0 comments · Fixed by #29806
Closed

[rttr] rttr provided with vcpkg cannot be build with C++20 #29794

pozemka opened this issue Feb 22, 2023 · 0 comments · Fixed by #29806
Assignees
Labels
category:port-update The issue is with a library, which is requesting update new revision

Comments

@pozemka
Copy link
Contributor

pozemka commented Feb 22, 2023

Is your feature request related to a problem? Please describe.
When I create basic HelloWorld with rttr it doesn't build if I choose C++ 20 in my Cmake file (set(CMAKE_CXX_STANDARD 20)).
It does build if I use C++17.
If I download RTTR directly from RTTR Github and apply simple patch I can compile helloworld.

Proposed solution
My proposal is to upadte RTTR in vcpkg to the latest commit and make necessary changes so programs that using rttr and C++20 could be build.

Describe alternatives you've considered
Fine alternative is to add rtti to sourcetree of my project and use local version instead of provided by vcpkg.
I also managed to change rttr's portfile.cmake and related patches to do what I want but it should be carefully maintained every time I update vckg subrepo.

Additional context
It seems that RTTI is abandoned by it's creator. Lots of unmerged PRs and unanswered tickets 😥

Mentioned helloworld and patch to rttr
Helloworld from here

#include <rttr/registration>
static void f() { std::cout << "Hello World" << std::endl; }
using namespace [rttr](https://www.rttr.org/doc/master/namespacerttr.html);
[RTTR_REGISTRATION](https://www.rttr.org/doc/master/registration_8h.html#ac6326400f16225ee15b52eabcaae8130)
{
    using namespace [rttr](https://www.rttr.org/doc/master/namespacerttr.html);
    [registration::method](https://www.rttr.org/doc/master/classrttr_1_1registration.html#ae37c7b97c7b6cc20d88d34d8aa26e12b)("f", &f);
}
int main()
{
    [type::invoke](https://www.rttr.org/doc/master/classrttr_1_1type.html#aa9d399ace70b2799d7bb6dab147e09a7)("f", {});
}
// outputs: "Hello World"

Patch is:

diff --git a/src/rttr/detail/misc/flat_map.h b/src/rttr/detail/misc/flat_map.h
index 767c97b..a3250a4 100644
--- a/src/rttr/detail/misc/flat_map.h
+++ b/src/rttr/detail/misc/flat_map.h
@@ -36,7 +36,7 @@
 #include <utility>
 #include <functional>
 #include <algorithm>
-#include <ciso646> // _LIBCPP_VERSION
+// #include <ciso646> // _LIBCPP_VERSION //warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20.
 
 namespace rttr
 {

Just in case error message when building with C++20:

rtti1\out\build\x64-Debug\vcpkg_installed\x64-windows\include\rttr\detail\registration\bind_impl.h(358): error C2760: syntax error: ')' was unexpected here; expected 'expression'
rtti1\out\build\x64-Debug\vcpkg_installed\x64-windows\include\rttr/detail/registration/bind_impl.h(349): note: This diagnostic occurred in the compiler generated function 'std::unique_ptr<rttr::detail::property_wrapper_base,std::default_deleterttr::detail::property_wrapper_base> rttr::registration::bindrttr::detail::prop,Class_Type,A,acc_level::create_default_property(rttr::string_view,Acc)'
rtti1\out\build\x64-Debug\vcpkg_installed\x64-windows\include\rttr/detail/registration/bind_impl.h(428): note: see reference to class template instantiation 'rttr::registration::bindrttr::detail::prop,Class_Type,A,acc_level' being compiled

@Cheney-W Cheney-W added the category:port-update The issue is with a library, which is requesting update new revision label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-update The issue is with a library, which is requesting update new revision
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants