// { dg-do compile { target c++20 } } #include #include constexpr bool test_cons() { std::optional oi(1); std::optional ol(oi); VERIFY( *ol == 1L ); VERIFY( *oi == 1 ); std::optional ou(std::move(oi)); VERIFY( *ou == 1u ); VERIFY( oi.has_value() && *oi == 1 ); return true; } static_assert( test_cons() );