devel/sol2: Fix compilation for clang 19.1

PR:		283287
This commit is contained in:
Peter Laursen 2024-12-14 22:21:44 -08:00 committed by Yuri Victorovich
parent 055b8cff9c
commit 2abe162d63
2 changed files with 18 additions and 1 deletions

View File

@ -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>

View File

@ -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.