mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-13 03:08:49 +07:00
fixed #104
This commit is contained in:
27
develop/untests/meta_issues/github_issue_104.cpp
Normal file
27
develop/untests/meta_issues/github_issue_104.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/meta.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2021-2024, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <meta.hpp/meta_all.hpp>
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
struct clazz {};
|
||||
}
|
||||
|
||||
TEST_CASE("meta/meta_issues/104") {
|
||||
namespace meta = meta_hpp;
|
||||
using namespace std::string_literals;
|
||||
|
||||
meta::class_<clazz>()
|
||||
.destructor_(meta::metadata_()("hello", "world"s));
|
||||
|
||||
CHECK(meta::resolve_type<clazz>().get_destructor().get_metadata().contains("hello"));
|
||||
|
||||
meta::class_<clazz>();
|
||||
|
||||
CHECK(meta::resolve_type<clazz>().get_destructor().get_metadata().contains("hello"));
|
||||
}
|
||||
@@ -16,7 +16,9 @@ namespace meta_hpp
|
||||
class_bind<Class>::class_bind(metadata_map metadata)
|
||||
: type_bind_base{resolve_type<Class>(), std::move(metadata)} {
|
||||
if constexpr ( std::is_destructible_v<Class> ) {
|
||||
destructor_();
|
||||
if ( get_data().destructors.empty() ) {
|
||||
destructor_();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user