libstdc++-v3/testsuite/20_util/from_chars/result.cc
raw| 1 | // { dg-do run { target c++26 } } |
| 2 | |
| 3 | #include <charconv> |
| 4 | #include <testsuite_hooks.h> |
| 5 | |
| 6 | void |
| 7 | test_result() |
| 8 | { |
| 9 | static_assert( ! std::is_convertible_v<std::from_chars_result, bool> ); |
| 10 | static_assert( std::is_constructible_v<bool, std::from_chars_result> ); |
| 11 | |
| 12 | std::from_chars_result res{}; |
| 13 | VERIFY( res ); |
| 14 | res.ec = std::errc::invalid_argument; |
| 15 | VERIFY( !res ); |
| 16 | } |
| 17 | |
| 18 | int main() |
| 19 | { |
| 20 | test_result(); |
| 21 | } |