From 4b3a60fb3285460afdc437a47a07330528d546a3 Mon Sep 17 00:00:00 2001 From: Lars Melchior Date: Sun, 2 Mar 2025 21:59:58 +0100 Subject: [PATCH] Investigate sol2 CI build issue (#648) * trigger CI to see if sol2 example is reliably failing * attempt patch from github comment * fix patch * add info to comment on patch * run fix-format * simplify patchfile --- examples/sol2/CMakeLists.txt | 10 ++++++++-- examples/sol2/fix_for_clang.patch | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 examples/sol2/fix_for_clang.patch diff --git a/examples/sol2/CMakeLists.txt b/examples/sol2/CMakeLists.txt index 57c6af2..9f118ea 100644 --- a/examples/sol2/CMakeLists.txt +++ b/examples/sol2/CMakeLists.txt @@ -8,7 +8,7 @@ include(../../cmake/CPM.cmake) CPMAddPackage( NAME lua - GIT_REPOSITORY https://github.com/lua/lua.git + GITHUB_REPOSITORY lua/lua VERSION 5.3.5 DOWNLOAD_ONLY YES ) @@ -21,7 +21,13 @@ if(lua_ADDED) target_include_directories(lua SYSTEM PUBLIC $) endif() -CPMAddPackage("gh:ThePhD/sol2@3.3.0") +CPMAddPackage( + NAME sol2 + GITHUB_REPOSITORY ThePhD/sol2 + VERSION 3.3.0 + # fix for clang 18.1.0, see https://github.com/ThePhD/sol2/issues/1581#issuecomment-2103463524 + PATCHES fix_for_clang.patch +) # ---- Executable ---- diff --git a/examples/sol2/fix_for_clang.patch b/examples/sol2/fix_for_clang.patch new file mode 100644 index 0000000..f8a8142 --- /dev/null +++ b/examples/sol2/fix_for_clang.patch @@ -0,0 +1,18 @@ +diff -u a/include/sol/function_types_stateless.hpp b/include/types/function_types_stateless.hpp +--- a/include/sol/function_types_stateless.hpp ++++ b/include/sol/function_types_stateless.hpp +@@ -322,7 +322,13 @@ namespace sol { namespace function_detail { + } + + template +- static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v) { ++ static int call(lua_State* L) ++#if SOL_IS_ON(SOL_COMPILER_CLANG) ++ // apparent regression in clang 18 - llvm/llvm-project#91362 ++#else ++ noexcept(std::is_nothrow_copy_assignable_v) ++#endif ++ { + int nr; + if constexpr (no_trampoline) { + nr = real_call(L);