Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr33735.C

raw
1 // { dg-do compile }
2 // { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
3 #include <string>
4 typedef struct _ts { } PyThreadState;
5 PyThreadState * Py_NewInterpreter(void);
6 void Py_EndInterpreter(PyThreadState *);
7 class ApplicationError {
8 public:
9 ApplicationError(std::string errormsg) : errormsg(errormsg) { }
10 std::string errormsg;
11 };
12 void run()
13 {
14 PyThreadState *py_state=__null;
15 try {
16 if (!(py_state=Py_NewInterpreter()))
17 throw ApplicationError("error");
18 }
19 catch(ApplicationError e) {
20 Py_EndInterpreter(py_state);
21 }
22 }