Fix the handling of director classes with final methods

Generated SwigDirector_* classes were attempting to override
methods marked as final.

In addition, give a warning if the destructor of a director class is
final.

Closes #564.
This commit is contained in:
Zackery Spytz 2019-02-22 06:28:53 -07:00
commit c3d652c785
7 changed files with 87 additions and 7 deletions

View file

@ -0,0 +1,18 @@
%module(directors="1") cpp11_final_directors
%warnfilter(SWIGWARN_PARSE_KEYWORD) final;
%director Derived;
%inline %{
struct Base {
virtual void basemeth() final {}
virtual ~Base() {}
};
struct Derived : Base {
virtual int derivedmeth() final { return 1; }
virtual int meth() { return 2; }
virtual ~Derived() {}
};
%}

View file

@ -0,0 +1,11 @@
import cpp11_final_directors
class Derived2(cpp11_final_directors.Derived):
def meth(self):
return 3
b = Derived2()
if b.meth() != 3:
raise RuntimeError