git: 2abe162d6320 - main - devel/sol2: Fix compilation for clang 19.1
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 15 Dec 2024 06:25:20 UTC
The branch main has been updated by yuri:
URL: https://cgit.FreeBSD.org/ports/commit/?id=2abe162d63206ff8004471e9c6a4152960084dcc
commit 2abe162d63206ff8004471e9c6a4152960084dcc
Author: Peter Laursen <freebsd@mosedal.net>
AuthorDate: 2024-12-15 06:21:44 +0000
Commit: Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-12-15 06:25:08 +0000
devel/sol2: Fix compilation for clang 19.1
PR: 283287
---
devel/sol2/Makefile | 7 ++++++-
.../extra-patch-include_sol_optional__implementation.hpp | 12 ++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/devel/sol2/Makefile b/devel/sol2/Makefile
index 5add3e1ba977..cf0a23a4465e 100644
--- a/devel/sol2/Makefile
+++ b/devel/sol2/Makefile
@@ -1,7 +1,7 @@
PORTNAME= sol2
DISTVERSIONPREFIX= v
DISTVERSION= 4.0.0-alpha
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
@@ -27,4 +27,9 @@ NO_ARCH= yes
EXTRA_PATCHES= ${PATCHDIR}/extra-patch-include_sol_function__types__stateless.hpp
.endif
+.if ${CHOSEN_COMPILER_TYPE} == clang && \
+ ${COMPILER_VERSION} >= 191
+EXTRA_PATCHES= ${PATCHDIR}/extra-patch-include_sol_optional__implementation.hp
+.endif
+
.include <bsd.port.post.mk>
diff --git a/devel/sol2/files/extra-patch-include_sol_optional__implementation.hpp b/devel/sol2/files/extra-patch-include_sol_optional__implementation.hpp
new file mode 100644
index 000000000000..809f9ae51cf1
--- /dev/null
+++ b/devel/sol2/files/extra-patch-include_sol_optional__implementation.hpp
@@ -0,0 +1,12 @@
+--- include/sol/optional_implementation.hpp.orig 2024-12-13 07:59:32 UTC
++++ include/sol/optional_implementation.hpp
+@@ -2191,7 +2191,8 @@ namespace sol {
+ static_assert(std::is_constructible<T, Args&&...>::value, "T must be constructible with Args");
+
+ *this = nullopt;
+- this->construct(std::forward<Args>(args)...);
++ new (static_cast<void*>(this)) optional(std::in_place, std::forward<Args>(args)...);
++ return **this;
+ }
+
+ /// Swaps this optional with the other.