xref: /netbsd-src/external/mit/isl/dist/isl_test_cpp17-checked.cc (revision 5971e316fdea024efff6be8f03536623db06833e)
1 #include <stdlib.h>
2 
3 #include <exception>
4 #include <iostream>
5 
6 #include <isl/options.h>
7 #include <isl/cpp-checked.h>
8 
9 /* Select the "checked" interface.
10  */
11 namespace isl { using namespace checked; }
12 
13 /* Print an error message and abort.
14  */
die_impl(const char * file,int line,const char * message)15 static void die_impl(const char *file, int line, const char *message)
16 {
17 	std::cerr << file << ":" << line << ": " << message << "\n";
18 	exit(EXIT_FAILURE);
19 }
20 
21 #define die(msg) die_impl(__FILE__, __LINE__, msg)
22 
23 #include "isl_test_cpp17-generic.cc"
24 
25 /* Test the C++17 specific features of the isl checked C++ interface
26  *
27  * In particular, test
28  *  - id::try_user
29  */
main()30 int main()
31 {
32 	isl_ctx *ctx = isl_ctx_alloc();
33 
34 	isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT);
35 
36 	test_try_user(ctx);
37 
38 	isl_ctx_free(ctx);
39 
40 	return EXIT_SUCCESS;
41 }
42