소스 검색

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 })
     {