Menu

#1160 allprotected + no virtual methods = uncompilable output

open
nobody
5
2023-06-24
2011-04-22
Alan Harder
No

This is a minor case, but figured I would report it.. with this a.swig:

%module(directors="1", allprotected="1") AModule;
%feature("director");

%inline %{
class A {
protected:
void foo();
};
%}

Because there are no virtual methods, the "SwigDirector_A" class is not generated in the output.
However, since there is a protected non-virtual method, the generated code includes a dynamic_cast to SwigDirector_A.
Perhaps the presence of a protected non-virtual method with allprotected="1" needs to trigger generation of the SwigDirector_ class.
(I used "swig -c++ -java" with swig 2.0.3, if it matters)

Discussion

  • Olly Betts

    Olly Betts - 2022-03-18

    Reproducible with git master:

    $ rgrep SwigDirector_A
    test_wrap.cxx:  SwigDirector_A *darg = 0;
    test_wrap.cxx:  darg = dynamic_cast<SwigDirector_A *>(arg1);
    
     
  • Olly Betts

    Olly Betts - 2023-06-24

    There have been some allprotected fixes recently, but this is still reproducible.

     

Log in to post a comment.