From 9dcf10138e5053d50a37a7837dc86e58d6b96dae Mon Sep 17 00:00:00 2001 From: Christophe Duvernois Date: Fri, 28 Apr 2017 11:45:36 +0200 Subject: [PATCH] csharp : noexcept method can't raise Swig::DirectorPureVirtualException --- Source/Modules/csharp.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 154fadac5..a8792f7ea 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -403,6 +403,7 @@ public: if (directorsEnabled()) { Printf(f_runtime, "#define SWIG_DIRECTORS\n"); + Printf(f_runtime, "#include \n"); /* Emit initial director header and director code: */ Swig_banner(f_directors_h); @@ -3935,7 +3936,12 @@ public: } Delete(super_call); } else { - Printf(w->code, " throw Swig::DirectorPureVirtualException(\"%s::%s\");\n", SwigType_namestr(c_classname), SwigType_namestr(name)); + if (Getattr(n, "noexcept")) { + Printf(w->code, " //can't throw exception here\n"); + Printf(w->code, " assert(0 && \"swig DirectorPureVirtualException %s::%s\");", SwigType_namestr(c_classname), SwigType_namestr(name)); + } else { + Printf(w->code, " throw Swig::DirectorPureVirtualException(\"%s::%s\");\n", SwigType_namestr(c_classname), SwigType_namestr(name)); + } } if (!ignored_method)