Bug 261485 - `Expected` constructor with `unexpect` tag is broken
Summary: `Expected` constructor with `unexpect` tag is broken
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gerald Squelart
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-09-12 16:54 PDT by Jean-Yves Avenard [:jya]
Modified: 2023-09-12 22:27 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.