- Mar 20, 2023
-
-
Jonathan Wakely authored
The presence of a template-head on this constructor is a copy & paste error from the primary template. libstdc++-v3/ChangeLog: PR libstdc++/109182 * include/std/expected (expected<void>::expected(in_place_t)): Remove template-head.
-
- Jan 16, 2023
-
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: PR libstdc++/108413 * include/c_compatibility/stdatomic.h: Change copyright line to be consistent with other headers contributed under DCO terms. * include/std/expected: Add full stop to copyright line. * src/c++20/tzdb.cc: Likewise.
-
- Dec 16, 2022
-
-
Jonathan Wakely authored
This was approved for C++23 last month in Kona. libstdc++-v3/ChangeLog: * include/std/expected (expected): Add monadic operations. (expected<void, E>): Likewise. * include/std/version (__cpp_lib_expected): Bump value. * testsuite/20_util/expected/synopsis.cc: Adjust expected macro value. * testsuite/20_util/expected/version.cc: Likewise. * testsuite/20_util/expected/illformed_neg.cc: Prune additional errors from ill-formed monadic operations. * testsuite/20_util/expected/observers.cc: Check error_or. * testsuite/20_util/expected/monadic.cc: New test.
-
Jonathan Wakely authored
This fixes some bugs in the swap functions for std::expected. It also disables the noexcept-specifiers for equality operators, because those are problematic when querying whether a std::expected is equality comparable. The operator==(const expected<T,E>&, const U&) function is not constrained, so is viable for comparing expected<T,E> with expected<void,G>, but then we get an error from the noexcept-specifier. libstdc++-v3/ChangeLog: * include/std/expected (expected::_M_swap_val_unex): Guard the correct object. (expected::swap): Move is_swappable requirement from static_assert to constraint. (swap): Likewise. (operator==): Remove noexcept-specifier. * testsuite/20_util/expected/swap.cc: Check swapping of types without non-throwing move constructor. Check constraints on swap. * testsuite/20_util/expected/unexpected.cc: Check constraints on swap. * testsuite/20_util/expected/equality.cc: New test.
-
- Nov 02, 2022
-
-
Jonathan Wakely authored
Hui Xie pointed out that we don't need a dummy member in the union, because all constructors always initialize either _M_val or _M_unex. We still need the _M_void member of the expected<void, E> specialization, because the constructor has to initialize something when not using the _M_unex member. libstdc++-v3/ChangeLog: * include/std/expected (expected::_M_invalid): Remove.
-
- Aug 04, 2022
-
-
Jonathan Wakely authored
The P2549R1 paper was accepted for C++23. I already implemented it for our <expected>, but I didn't rename the private daata members, only the public member functions. This renames the data members for consistency with the working draft. libstdc++-v3/ChangeLog: * include/std/expected (unexpected::_M_val): Rename to _M_unex. (bad_expected_access::_M_val): Likewise.
-
- Apr 08, 2022
-
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: PR libstdc++/105153 * include/std/expected (expected<void,E>::expected(expected<U,G>&&)): Fix constraints. * testsuite/20_util/expected/cons.cc: Check constructor.
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: PR libstdc++/105154 * include/std/expected (expected<void, E>::swap): Set _M_has_value to false for objects that previously had a value. * testsuite/20_util/expected/swap.cc: Fix test to check void specialization.
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: PR libstdc++/105146 * include/std/expected (bad_expected_access): Move constructor parameter. * testsuite/20_util/expected/bad.cc: New test.
-
- Mar 27, 2022
-
-
Jonathan Wakely authored
Because this adds a new class template called std::unexpected, we have to stop declaring the std::unexpected() function (which was deprecated in C++11 and removed in C++17). libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in: Add new header. * include/Makefile.am: Likewise. * include/Makefile.in: Regenerate. * include/precompiled/stdc++.h: Add new header. * include/std/version (__cpp_lib_expected): Define. * libsupc++/exception [__cplusplus > 202002] (unexpected) (unexpected_handler, set_unexpected): Do not declare for C++23. * include/std/expected: New file. * testsuite/20_util/expected/assign.cc: New test. * testsuite/20_util/expected/cons.cc: New test. * testsuite/20_util/expected/illformed_neg.cc: New test. * testsuite/20_util/expected/observers.cc: New test. * testsuite/20_util/expected/requirements.cc: New test. * testsuite/20_util/expected/swap.cc: New test. * testsuite/20_util/expected/synopsis.cc: New test. * testsuite/20_util/expected/unexpected.cc: New test. * testsuite/20_util/expected/version.cc: New test.
-