Debian Codegraph @

libstdc++-v3/testsuite/20_util/optional/84601.cc

raw
1 // { dg-do compile { target c++17 } }
2
3 #include <optional>
4 #include <utility>
5
6 using pair_t = std::pair<int, int>;
7 using opt_t = std::optional<pair_t>;
8
9 static_assert(std::is_copy_constructible_v<opt_t::value_type>);
10 static_assert(std::is_copy_assignable_v<opt_t::value_type>);
11
12 static_assert(std::is_copy_assignable_v<opt_t>); // assertion fails.
13
14 class A
15 {
16 void f(const opt_t& opt)
17 {
18 _opt = opt;
19 }
20
21 opt_t _opt;
22 };