Bug 261485

Summary: `Expected` constructor with `unexpect` tag is broken
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: Web Template FrameworkAssignee: Gerald Squelart <g_squelart>
Status: RESOLVED FIXED    
Severity: Normal CC: g_squelart, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Jean-Yves Avenard [:jya] 2023-09-12 16:54:35 PDT
Trying to construct an `Expected<int, double>` using `Expected(unexpect, 32.0)` gave me a compilation error 
"No viable conversion from 'std::experimental::unexpected<double>' to 'value_type' (aka 'int')"

The code is wrong 
https://searchfox.org/wubkat/rev/b38121da42a0483fdb1bc13782f1c7a8059de100/Source/WTF/wtf/Expected.h#448

`template<class... Args> constexpr explicit expected(unexpected_t, Args&&... args) : base(__expected_detail::value_tag, unexpected_type(std::forward<Args>(args)...)) { }`
should be:

`template<class... Args> constexpr explicit expected(unexpected_t, Args&&... args) : base(__expected_detail::error_tag, unexpected_type(std::forward<Args>(args)...)) { }`
Comment 1 Radar WebKit Bug Importer 2023-09-12 18:55:21 PDT
<rdar://problem/115401559>
Comment 2 Gerald Squelart 2023-09-12 19:09:53 PDT
Pull request: https://github.com/WebKit/WebKit/pull/17720
Comment 3 EWS 2023-09-12 22:27:25 PDT
Committed 267931@main (95191e8f4045): <https://commits.webkit.org/267931@main>

Reviewed commits have been landed. Closing PR #17720 and removing active labels.