kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_constexpr_exception.cpp
Go to the documentation of this file.
1#include <stdexcept>
2
14
15#if !defined(__cpp_constexpr_exceptions)
16# error "C++ constexpr exception is required for this test."
17#endif
18
19namespace Tests::Std {
20
22consteval void throw_invalid_argument() {
23 throw std::invalid_argument{"message"};
24}
25
27consteval bool test_catch_exception() {
28 try {
30 return false;
31 } catch (const std::invalid_argument& iarg) {
32 return std::string_view{iarg.what()} == "message";
33 }
34}
35
36static_assert(test_catch_exception());
37
38} // namespace Tests::Std
consteval void throw_invalid_argument()
Unconditionally throw a std::invalid_argument exception.
consteval bool test_catch_exception()