LibJS: Use a forwarding reference in ThrowCompletion constructor

This avoids compiler complaints when trying to use const types
This commit is contained in:
Matthew Olsson 2023-02-25 10:43:48 -07:00 committed by Linus Groh
parent 17a528c49e
commit d4b08b7196
Notes: sideshowbarker 2024-07-17 02:23:25 +09:00

View File

@ -307,7 +307,7 @@ public:
// Most commonly: Value from Object* or similar, so we can omit the curly braces from "return { TRY(...) };".
// Disabled for POD types to avoid weird conversion shenanigans.
template<typename WrappedValueType>
ThrowCompletionOr(WrappedValueType const& value)
ThrowCompletionOr(WrappedValueType&& value)
requires(!IsPOD<ValueType>)
: m_value_or_throw_completion(ValueType { value })
{