Skip to content

Commit

Permalink
fix: fix clang-cl test compile
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Jan 30, 2024
1 parent 9875237 commit 4140586
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/ll/api/base/Meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ template <class Group, class T, auto Id = int64{}>
}
}

#ifndef __clang__
template <class Group>
struct DynamicTypeList {
template <size_t N>
Expand Down Expand Up @@ -191,4 +192,6 @@ struct DynamicTypeList {
Setter<id, next> setter{};
}
};
#endif

} // namespace ll::meta
6 changes: 4 additions & 2 deletions src/ll/test/ConfigTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ class TestClass {
// LL_AUTO_TYPE_INSTANCE_HOOK(Virtual, HookPriority::Normal, FillCommand, &FillCommand::execute, void, CommandOrigin
// const&, CommandOutput&) {
// }

#ifndef __clang__
struct myTypeList1 : ll::meta::DynamicTypeList<myTypeList1> {};
struct myTypeList2 : ll::meta::DynamicTypeList<myTypeList2> {};
struct myTypeList3 : ll::meta::TypeList<bool, int> {};
struct myTypeList4 : ll::meta::TypeList<> {};
#endif

LL_AUTO_TYPE_INSTANCE_HOOK(ConfigTest, HookPriority::Normal, ServerInstance, &ServerInstance::startServerThread, void) {
origin();
Expand Down Expand Up @@ -153,7 +154,7 @@ LL_AUTO_TYPE_INSTANCE_HOOK(ConfigTest, HookPriority::Normal, ServerInstance, &Se

ll::logger.debug("789\xDB\xFE");
ll::logger.debug("789\xDB\xFE");

#ifndef __clang__
myTypeList1::push_back<int>();
myTypeList1::push_back<float>();
ll::logger.debug("{}", ll::reflection::type_raw_name_v<decltype(myTypeList1::value())>);
Expand Down Expand Up @@ -186,4 +187,5 @@ LL_AUTO_TYPE_INSTANCE_HOOK(ConfigTest, HookPriority::Normal, ServerInstance, &Se
myTypeList4::forEach([]<typename T>() { ll::logger.debug(typeid(T).name()); });

myTypeList4::forEachIndexed([]<typename T>(size_t index) { ll::logger.debug("{} : {}", typeid(T).name(), index); });
#endif
}
6 changes: 4 additions & 2 deletions src/ll/test/EventTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@

#include "ll/api/utils/HashUtils.h"

#ifndef __clang__
struct myTypeList2 : ll::meta::DynamicTypeList<myTypeList2> {};
#endif

using namespace ll::hash_utils;
using namespace ll::hash_literals;
Expand Down Expand Up @@ -211,10 +213,10 @@ LL_AUTO_TYPE_INSTANCE_HOOK(
.debug("Player {} MultiListener of {}", ev.self().getRealName(), ll::reflection::type_raw_name_v<decltype(ev)>);
});
bus.addListener(mul);

#ifndef __clang__
myTypeList2::push_back<float>();
ll::logger.debug("{}", typeid(myTypeList2::value()).name());

#endif
auto dl = DynamicListener::create([](CompoundTag& nbt) {
// nbt["cancelled"] = true;
ll::logger.debug("{}", nbt.toSnbt(SnbtFormat::PrettyConsolePrint));
Expand Down

0 comments on commit 4140586

Please sign in to comment.