aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/throw_exception.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/throw_exception.i')
-rw-r--r--Examples/test-suite/throw_exception.i30
1 files changed, 16 insertions, 14 deletions
diff --git a/Examples/test-suite/throw_exception.i b/Examples/test-suite/throw_exception.i
index 396c633a6..ed9288290 100644
--- a/Examples/test-suite/throw_exception.i
+++ b/Examples/test-suite/throw_exception.i
@@ -1,9 +1,11 @@
%module throw_exception
+// throw is invalid in C++17 and later, only SWIG to use it
+#define TESTCASE_THROW1(T1) throw(T1)
+#define TESTCASE_THROW3(T1, T2, T3) throw(T1, T2, T3)
%{
-#if defined(_MSC_VER)
- #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
-#endif
+#define TESTCASE_THROW1(T1)
+#define TESTCASE_THROW3(T1, T2, T3)
%}
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum1;
@@ -30,45 +32,45 @@ namespace Namespace {
}
class Foo {
public:
- void test_int() throw(int) {
+ void test_int() TESTCASE_THROW1(int) {
throw 37;
}
- void test_msg() throw(const char *) {
+ void test_msg() TESTCASE_THROW1(const char *) {
throw "Dead";
}
- void test_cls() throw(CError) {
+ void test_cls() TESTCASE_THROW1(CError) {
throw CError();
}
- void test_cls_ptr() throw(CError *) {
+ void test_cls_ptr() TESTCASE_THROW1(CError *) {
static CError StaticError;
throw &StaticError;
}
- void test_cls_ref() throw(CError &) {
+ void test_cls_ref() TESTCASE_THROW1(CError &) {
static CError StaticError;
throw StaticError;
}
- void test_cls_td() throw(Namespace::ErrorTypedef) {
+ void test_cls_td() TESTCASE_THROW1(Namespace::ErrorTypedef) {
throw CError();
}
- void test_cls_ptr_td() throw(Namespace::ErrorPtr) {
+ void test_cls_ptr_td() TESTCASE_THROW1(Namespace::ErrorPtr) {
static CError StaticError;
throw &StaticError;
}
- void test_cls_ref_td() throw(Namespace::ErrorRef) {
+ void test_cls_ref_td() TESTCASE_THROW1(Namespace::ErrorRef) {
static CError StaticError;
throw StaticError;
}
- void test_array() throw(Namespace::IntArray) {
+ void test_array() TESTCASE_THROW1(Namespace::IntArray) {
static Namespace::IntArray array;
for (int i=0; i<10; i++) {
array[i] = i;
}
throw array;
}
- void test_enum() throw(Namespace::EnumTest) {
+ void test_enum() TESTCASE_THROW1(Namespace::EnumTest) {
throw Namespace::enum2;
}
- void test_multi(int x) throw(int, const char *, CError) {
+ void test_multi(int x) TESTCASE_THROW3(int, const char *, CError) {
if (x == 1) throw 37;
if (x == 2) throw "Dead";
if (x == 3) throw CError();