diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index d63f53357a..68b38978e4 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -602,6 +602,9 @@ public: Optional() = default; + template V> + Optional(V) { } + Optional(Optional const& other) { if (other.has_value()) @@ -614,12 +617,20 @@ public: } template + requires(!IsSame>) explicit(!IsConvertible) Optional(U&& value) requires(!IsSame, Optional> && IsConstructible) : m_value(forward(value)) { } + template V> + Optional& operator=(V) + { + clear(); + return *this; + } + Optional& operator=(Optional const& other) { if (this != &other) {