Skip to content

Commit 7473402

Browse files
error_run_with_large_stack_throws should compile without exceptions (#5884)
(1) Some downstream environments compile C++ without exceptions by default; this won't compile on those. (2) We should check that assert-fail also errors out as expected.
1 parent ea76214 commit 7473402

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/error/run_with_large_stack_throws.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <iostream>
33

44
int main() {
5+
#ifdef __cpp_exceptions
56
try {
67
Halide::Internal::run_with_large_stack([]() {
78
throw Halide::RuntimeError("Error from run_with_large_stack");
@@ -11,6 +12,11 @@ int main() {
1112
return 1;
1213
}
1314

15+
#else
16+
Halide::Internal::run_with_large_stack([]() {
17+
_halide_user_assert(0) << "Error from run_with_large_stack (no exceptions)";
18+
});
19+
#endif
1420
std::cout << "Success!\n";
1521
return 0;
1622
}

0 commit comments

Comments
 (0)