-
-
Notifications
You must be signed in to change notification settings - Fork 518
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
fix emplace #1606
fix emplace #1606
Conversation
Hi, can you merge? Thanks. |
I don't understand the problem, but this code part blocks the build with the latest version of emscripten. |
Just to give more context, the error #1611 here is shown with the latest version of emscripten. This PR seems to fix it. |
This is just a straight copy of ThePhD/sol2#1606 from sol2 to fix compilation under clang++ 19 as it's more restrictive in veryfying code under templates.
This is just a straight copy of ThePhD/sol2#1606 from sol2 to fix compilation under clang++ 19 as it's more restrictive in veryfying code under templates.
I don’t think this implementation of Consider: template <class T>
class optional<T&> {
...
template <class... Args>
T& emplace(Args&&... args) noexcept {
static_assert(std::is_constructible<T, Args&&...>::value, "T must be constructible with Args");
*this = nullopt;
new (static_cast<void*>(this)) optional(std::in_place, std::forward<Args>(args)...);
return **this;
}
...
}; Now look at the When called with Since you know T& emplace(T& arg) noexcept {
m_value = &arg;
return **this;
} |
sol::optional<T&>::emplace was broken, and depended on the compiler not checking that members exist if the template wasn't instantiated. See ThePhD/sol2#1606 and ThePhD/sol2#1648.
No description provided.