Browse Source

LibJS: Use a forwarding reference in ThrowCompletion constructor

This avoids compiler complaints when trying to use const types
Matthew Olsson 2 years ago
parent
commit
d4b08b7196
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Userland/Libraries/LibJS/Runtime/Completion.h

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Completion.h

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