| 119 | #endif |
| 120 | |
| 121 | int main() |
| 122 | { |
| 123 | { |
| 124 | leaf::result<val const> r1, r2; |
| 125 | leaf::result<val const> & ref = r1; |
| 126 | leaf::result<val const> const & cref = r1; |
| 127 | leaf::result<val const> && rvref = std::move(r1); |
| 128 | leaf::result<val const> const && rvcref = std::move(r2); |
| 129 | |
| 130 | static_assert(std::is_same<decltype(ref.value()), val const &>::value, "result type deduction bug"); |
| 131 | static_assert(std::is_same<decltype(cref.value()), val const &>::value, "result type deduction bug"); |
| 132 | static_assert(std::is_same<decltype(std::move(rvref.value())), val const &&>::value, "result type deduction bug"); |
| 133 | static_assert(std::is_same<decltype(std::move(rvcref.value())), val const &&>::value, "result type deduction bug"); |
| 134 | |
| 135 | static_assert(std::is_same<decltype(*ref), val const &>::value, "result type deduction bug"); |
| 136 | static_assert(std::is_same<decltype(*cref), val const &>::value, "result type deduction bug"); |
| 137 | static_assert(std::is_same<decltype(std::move(*rvref)), val const &&>::value, "result type deduction bug"); |
| 138 | static_assert(std::is_same<decltype(std::move(*rvcref)), val const &&>::value, "result type deduction bug"); |
| 139 | |
| 140 | auto & ref_id = ref->id; static_assert(std::is_same<decltype(ref_id), int const &>::value, "result type deduction bug"); |
| 141 | auto & cref_id = cref->id; static_assert(std::is_same<decltype(cref_id), int const &>::value, "result type deduction bug"); |
| 142 | auto & rvref_id = rvref->id; static_assert(std::is_same<decltype(rvref_id), int const &>::value, "result type deduction bug"); |
| 143 | auto & rvcref_id = rvcref->id; static_assert(std::is_same<decltype(rvcref_id), int const &>::value, "result type deduction bug"); |
| 144 | } |
| 145 | |
| 146 | { |
| 147 | leaf::result<val> r1, r2; |
| 148 | leaf::result<val> & ref = r1; |
| 149 | leaf::result<val> const & cref = r1; |
| 150 | leaf::result<val> && rvref = std::move(r1); |
| 151 | leaf::result<val> const && rvcref = std::move(r2); |
| 152 | |
| 153 | static_assert(std::is_same<decltype(ref.value()), val &>::value, "result type deduction bug"); |
| 154 | static_assert(std::is_same<decltype(cref.value()), val const &>::value, "result type deduction bug"); |
| 155 | static_assert(std::is_same<decltype(std::move(rvref.value())), val &&>::value, "result type deduction bug"); |
| 156 | static_assert(std::is_same<decltype(std::move(rvcref.value())), val const &&>::value, "result type deduction bug"); |
| 157 | |
| 158 | static_assert(std::is_same<decltype(*ref), val &>::value, "result type deduction bug"); |
| 159 | static_assert(std::is_same<decltype(*cref), val const &>::value, "result type deduction bug"); |
| 160 | static_assert(std::is_same<decltype(std::move(*rvref)), val &&>::value, "result type deduction bug"); |
| 161 | static_assert(std::is_same<decltype(std::move(*rvcref)), val const &&>::value, "result type deduction bug"); |
| 162 | |
| 163 | auto & ref_id = ref->id; static_assert(std::is_same<decltype(ref_id), int &>::value, "result type deduction bug"); |
| 164 | auto & cref_id = cref->id; static_assert(std::is_same<decltype(cref_id), int const &>::value, "result type deduction bug"); |
| 165 | auto & rvref_id = rvref->id; static_assert(std::is_same<decltype(rvref_id), int &>::value, "result type deduction bug"); |
| 166 | auto & rvcref_id = rvcref->id; static_assert(std::is_same<decltype(rvcref_id), int const &>::value, "result type deduction bug"); |
| 167 | } |
| 168 | |
| 169 | { |
| 170 | val v; |
| 171 | leaf::result<val const &> r1(v), r2(v); |
| 172 | leaf::result<val const &> & ref = r1; |
| 173 | leaf::result<val const &> const & cref = r1; |
| 174 | leaf::result<val const &> && rvref = std::move(r1); |
| 175 | leaf::result<val const &> const && rvcref = std::move(r2); |
| 176 | |
| 177 | static_assert(std::is_same<decltype(ref.value()), val const &>::value, "result type deduction bug"); |
| 178 | static_assert(std::is_same<decltype(cref.value()), val const &>::value, "result type deduction bug"); |
nothing calls this directly
no test coverage detected