diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-04-08 18:26:23 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-04-08 18:30:07 +0100 |
commit | 7b4495d3c4040d8f56c05dd254d76269d4471623 (patch) | |
tree | b014f6b9019a46e2341f5073506589433cb85467 /libstdc++-v3/testsuite | |
parent | 0dfaf562521ba97c18398d027bf44a15f802f303 (diff) |
libstdc++: Fix constraints on std::expected<void, E> constructor [PR105153]
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.
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/20_util/expected/cons.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/20_util/expected/cons.cc b/libstdc++-v3/testsuite/20_util/expected/cons.cc index 1fe5b7bf4d1..6946858198c 100644 --- a/libstdc++-v3/testsuite/20_util/expected/cons.cc +++ b/libstdc++-v3/testsuite/20_util/expected/cons.cc @@ -162,6 +162,22 @@ test_copy() return true; } +constexpr bool +test_pr105153() +{ + struct E { + E(int&&) = delete; + E(const int&); + }; + + std::expected<void, E> e(std::expected<void, int>{}); + + static_assert( ! std::is_constructible_v<std::expected<void, int>, + std::expected<int, int>> ); + + return true; +} + int main() { test_default(); @@ -172,4 +188,6 @@ int main() static_assert( test_err() ); test_copy(); static_assert( test_copy() ); + test_pr105153(); + static_assert( test_pr105153() ); } |