From 238170d0e2f21b20caf4cd345b59c2772fa46a06 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 1 Aug 2021 11:02:05 +0200 Subject: [PATCH] meta: some changes to make tests compile with C++20 (MSVC) --- test/entt/meta/meta_any.cpp | 6 +++--- test/entt/meta/meta_conv.cpp | 2 +- test/entt/meta/meta_ctor.cpp | 6 +++--- test/entt/meta/meta_data.cpp | 5 +++-- test/entt/meta/meta_dtor.cpp | 4 ++-- test/entt/meta/meta_func.cpp | 9 +++++---- test/entt/meta/meta_type.cpp | 6 +++--- 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/test/entt/meta/meta_any.cpp b/test/entt/meta/meta_any.cpp index 351902c04..2679081d1 100644 --- a/test/entt/meta/meta_any.cpp +++ b/test/entt/meta/meta_any.cpp @@ -66,18 +66,18 @@ struct MetaAny: ::testing::Test { entt::meta() .type("empty"_hs) - .dtor<&empty_t::destroy>(); + .dtor(); entt::meta() .type("fat"_hs) .base() - .dtor<&fat_t::destroy>(); + .dtor(); entt::meta() .type("clazz"_hs) .data<&clazz_t::value>("value"_hs) .func<&clazz_t::member>("member"_hs) - .func<&clazz_t::func>("func"_hs); + .func("func"_hs); empty_t::destroy_counter = 0; empty_t::destructor_counter = 0; diff --git a/test/entt/meta/meta_conv.cpp b/test/entt/meta/meta_conv.cpp index df5616d0b..672aa8c73 100644 --- a/test/entt/meta/meta_conv.cpp +++ b/test/entt/meta/meta_conv.cpp @@ -22,7 +22,7 @@ struct MetaConv: ::testing::Test { entt::meta() .type("clazz"_hs) .conv() - .conv<&conv_to_double>(); + .conv(); } void TearDown() override { diff --git a/test/entt/meta/meta_ctor.cpp b/test/entt/meta/meta_ctor.cpp index 671720844..6f82ffbb5 100644 --- a/test/entt/meta/meta_ctor.cpp +++ b/test/entt/meta/meta_ctor.cpp @@ -39,7 +39,7 @@ struct MetaCtor: ::testing::Test { entt::meta() .type("double"_hs) .conv() - .ctor<&double_factory>(); + .ctor(); entt::meta() .type("derived"_hs) @@ -50,8 +50,8 @@ struct MetaCtor: ::testing::Test { .ctor<&entt::registry::emplace_or_replace, entt::as_ref_t>() .ctor() .ctor().prop(3, false) - .ctor(&clazz_t::factory)>().prop('c', 42) - .ctor(&clazz_t::factory)>(); + .ctor(clazz_t::factory)>().prop('c', 42) + .ctor(clazz_t::factory)>(); } void TearDown() override { diff --git a/test/entt/meta/meta_data.cpp b/test/entt/meta/meta_data.cpp index e4e087d21..edf0b8177 100644 --- a/test/entt/meta/meta_data.cpp +++ b/test/entt/meta/meta_data.cpp @@ -6,6 +6,7 @@ struct base_t { virtual ~base_t() = default; + static void destroy(base_t &) { ++counter; } @@ -82,13 +83,13 @@ struct MetaData: ::testing::Test { entt::meta() .type("base"_hs) - .dtor<&base_t::destroy>() + .dtor() .data<&base_t::value>("value"_hs); entt::meta() .type("derived"_hs) .base() - .dtor<&derived_t::destroy>(); + .dtor(); entt::meta() .type("clazz"_hs) diff --git a/test/entt/meta/meta_dtor.cpp b/test/entt/meta/meta_dtor.cpp index e94eb349a..8a8a962f1 100644 --- a/test/entt/meta/meta_dtor.cpp +++ b/test/entt/meta/meta_dtor.cpp @@ -27,7 +27,7 @@ struct MetaDtor: ::testing::Test { entt::meta() .type("clazz"_hs) - .dtor<&clazz_t::destroy_decr>(); + .dtor(); clazz_t::counter = 0; } @@ -104,7 +104,7 @@ TEST_F(MetaDtor, ReRegistration) { ASSERT_NE(node->dtor, nullptr); - entt::meta().dtor<&clazz_t::destroy_incr>(); + entt::meta().dtor(); entt::resolve().construct().reset(); ASSERT_EQ(clazz_t::counter, 2); diff --git a/test/entt/meta/meta_func.cpp b/test/entt/meta/meta_func.cpp index 8cd7e0184..07ef59418 100644 --- a/test/entt/meta/meta_func.cpp +++ b/test/entt/meta/meta_func.cpp @@ -8,6 +8,7 @@ struct base_t { virtual ~base_t() = default; + static void destroy(base_t &) { ++counter; } @@ -71,13 +72,13 @@ struct MetaFunc: ::testing::Test { entt::meta() .type("base"_hs) - .dtor<&base_t::destroy>() + .dtor() .func<&base_t::func>("func"_hs); entt::meta() .type("derived"_hs) .base() - .dtor<&derived_t::destroy>(); + .dtor(); entt::meta() .type("func"_hs) @@ -86,8 +87,8 @@ struct MetaFunc: ::testing::Test { .func(&func_t::f)>("f2"_hs).prop(true, false) .func(&func_t::f)>("f1"_hs).prop(true, false) .func<&func_t::g>("g"_hs).prop(true, false) - .func<&func_t::h>("h"_hs).prop(true, false) - .func<&func_t::k>("k"_hs).prop(true, false) + .func("h"_hs).prop(true, false) + .func("k"_hs).prop(true, false) .func<&func_t::v, entt::as_void_t>("v"_hs) .func<&func_t::a, entt::as_ref_t>("a"_hs) .func<&func_t::a, entt::as_cref_t>("ca"_hs); diff --git a/test/entt/meta/meta_type.cpp b/test/entt/meta/meta_type.cpp index d26a8a5bc..265940709 100644 --- a/test/entt/meta/meta_type.cpp +++ b/test/entt/meta/meta_type.cpp @@ -99,7 +99,7 @@ struct MetaType: ::testing::Test { entt::meta() .type("double"_hs) .conv() - .data<&set, &get>("var"_hs); + .data, get>("var"_hs); entt::meta() .type("unsigned int"_hs) @@ -144,7 +144,7 @@ struct MetaType: ::testing::Test { .prop([]() { return property_t::key_only; }) .data("list"_hs) .props(std::make_pair(property_t::random, false), std::make_pair(property_t::value, 0), property_t::key_only) - .data<&set, &get>("var"_hs); + .data, get>("var"_hs); entt::meta() .type("clazz"_hs) @@ -152,7 +152,7 @@ struct MetaType: ::testing::Test { .ctor() .data<&clazz_t::value>("value"_hs) .func<&clazz_t::member>("member"_hs) - .func<&clazz_t::func>("func"_hs); + .func("func"_hs); } void TearDown() override {