-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Doesn't build with Clang 18.1.0 #1581
Comments
I have this issue too. For what it's worth, replacing |
Same issue here while building MAME, latest MSYS2 has just deployed LLVM 18.1 components. Possibly related to the following Clang bugfix "Clang will correctly evaluate noexcept expression for template functions of template classes." - see https://prereleases.llvm.org/18.1.0/rc3/tools/clang/docs/ReleaseNotes.html The workaround from Razakhel above resolves compilation but the binary is non-working. |
Binary is working now with compilation workaround, was unrelated error my part. |
I think this is a bug in clang. The |
OK, it’s actually pretty easy to reproduce – this builds with clang 17 but not with clang 18 as C++17: template <typename T>
struct class_tmpl {
template <bool B> static void call_e() { }
template <bool B> static void call_ne() noexcept { }
template <bool B> static void call() noexcept(sizeof(T) > 1) { }
};
int main(int argc, char *argv[])
{
using function_ptr = void (*)();
function_ptr f1 = &class_tmpl<int>::call_e<false>;
function_ptr f2 = &class_tmpl<int>::call_ne<false>;
function_ptr f3 = &class_tmpl<int>::call<false>;
return 0;
} Results:
|
Reported as llvm/llvm-project#91362 |
Fixed in llvm main branch by llvm/llvm-project#90760. I don't know when this will make it into a clang release. |
Cool, I'll close this as soon as it's in a Clang release and tested |
You can use this workaround in the mean time: diff --git a/3rdparty/sol2/sol/sol.hpp b/3rdparty/sol2/sol/sol.hpp index 8b0b7d36ea4ef..1a9375d996d2f 100644
--- a/3rdparty/sol2/sol/sol.hpp
+++ b/3rdparty/sol2/sol/sol.hpp
@@ -19416,7 +19416,13 @@ namespace sol { namespace function_detail {
}
template <bool is_yielding, bool no_trampoline>
- static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v<T>) {
+ 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<T>)
+#endif
+ {
int nr;
if constexpr (no_trampoline) {
nr = real_call(L);
@@ -19456,7 +19462,13 @@ namespace sol { namespace function_detail {
}
template <bool is_yielding, bool no_trampoline>
- static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v<T>) {
+ 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<T>)
+#endif
+ {
int nr;
if constexpr (no_trampoline) {
nr = real_call(L); That's on the single-header version, but you should be able to work out how to apply it to the source headers. |
Hey @ThePhD |
I find it ironic that a popular library by someone on the committee is not considered worthy enough of llvm devs to back-port fixes for lol. |
- Update `README.md` - Apply workaround for bug in Clang 18 See: ThePhD/sol2#1581 - Use symlinks for all library source files This allows to apply custom workarounds for external bugs. - Run tests as independent package Currently, the latest `catch2` package from `cppget.org` fails to compile with Clang and leads to false-negative results. - Add `sol2-examples` package with upstream examples - Add `sol2-tests` package with upstream tests - Update `manifest` - Tweak and clean up `buildfile`s - Add `README.md` and `PACKAGE-README.md` symlinks - Add symlinks to Sol2 license file - Transform into multi-package repository - Add `.gitattributes` - Update `.gitignore` - Use standard build2 naming scheme None of the standard build2 filenames clash with upstream source code. Revert alternative naming scheme to be canonical. Issue: #1
it's a known llvm bug that isn't backported to clang 18 yet. applied workaround to sol2 instead. see: ThePhD/sol2#1581 (comment)
it's a known llvm bug that isn't backported to clang 18 yet. applied workaround to sol2 instead. see: ThePhD/sol2#1581 (comment)
Attempted this fix, did not work for me |
Work around a regression in Clang 18. ThePhD/sol2#1581 (comment)
On the latest major release (candidate) of Clang, sol2 flat out doesn't compile with a fatal error and spits out a bunch of warnings.
https://github.com/jpxs-intl/RosaServer/actions/runs/7929791195/job/21650728959 for the run logs, or here:
The text was updated successfully, but these errors were encountered: