aboutsummaryrefslogtreecommitdiff
path: root/Lib/d
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2017-05-13 17:01:15 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2017-05-13 17:01:15 +0100
commit07ab80b49e0b51931a7e309b8c62b72a459efe64 (patch)
tree7dac2c84d6ef489e15b1c93a713ef9b8f768a9cd /Lib/d
parent971404485f559bf8dcdcf12d74411f63e439d5b5 (diff)
downloadswig-07ab80b49e0b51931a7e309b8c62b72a459efe64.tar.gz
Add raise methods for throwing c++ exceptions in C#, Java, D
The director c++ exceptions are thrown in a helper method instead of in the director overloaded method. This circumvents compiler warnings about throwing exceptions when the method has an exception specification or noexcept. If the exception is thrown, abort will still be called! In Java, the "director:noexcept" typemap can be used to do something else. This typemap should be ported to the other languages too.
Diffstat (limited to 'Lib/d')
-rw-r--r--Lib/d/director.swg4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/d/director.swg b/Lib/d/director.swg
index a7d9c7688..02da0e0ac 100644
--- a/Lib/d/director.swg
+++ b/Lib/d/director.swg
@@ -40,6 +40,10 @@ namespace Swig {
public:
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempted to invoke pure virtual method ") + msg) {
}
+
+ static void raise(const char *msg) {
+ throw DirectorPureVirtualException(msg);
+ }
};
}