Преглед на файлове

LibJS: Use a forwarding reference in ThrowCompletion constructor

This avoids compiler complaints when trying to use const types
Matthew Olsson преди 2 години
родител
ревизия
d4b08b7196
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  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(...) };".
     // 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 })
     {