]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Improve static assert messages for monadic operations
authorJonathan Wakely <jwakely@redhat.com>
Wed, 1 Nov 2023 14:28:55 +0000 (14:28 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 8 Nov 2023 13:16:29 +0000 (13:16 +0000)
commit2c090215eac4c6e923a12d61c80c4f44bdcb5c75
tree74413a3f4b556d84634c81764efed7a00e61671a
parentc6e03a1c54451eaab872dcdd8ab927b7efe16c9c
libstdc++: Improve static assert messages for monadic operations

The monadic operations for std::optional and std::expected make use of
internal helper traits __is_optional nad __is_expected, which are not
very user-friendly when shown in diagnostics. Add messages to the
assertions explaining the problem more clearly.

libstdc++-v3/ChangeLog:

* include/std/expected (expected::and_then, expected::or_else):
Add string literals to static assertions.
* include/std/optional (optional::and_then, optional::or_else):
Likewise.

(cherry picked from commit 3d654f96d4c583c35e4f73aa8f11371730671534)
libstdc++-v3/include/std/expected
libstdc++-v3/include/std/optional