Olly Betts - 2022-03-07

I've managed to piece together a complete testcase which reproduces the issue here with current git master:

$ cat test.i
%module test
%inline {
typedef unsigned char uint8;
}

%include cpointer.i
%pointer_functions(uint8*, uint8pp);

%inline {
void f(uint8* source, int file_size, int* width, int* height, uint8** dest) {}
}
$ ../preinst-swig -python -c++ test.i
$ g++ `python3-config --cflags` -fPIC -shared test_wrap.cxx -o _test.so
test_wrap.cxx: In function uint8** copy_uint8pp(uint8*):
test_wrap.cxx:3094:24: error: invalid static_cast from type uint8* {aka unsigned char*} to type const uint8*& {aka const unsigned char*&}
 3094 |     return (new uint8*(static_cast< const uint8*& >(value)));
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The documentation in Library.html for %pointer_functions says: "When using this macro, type may be any type", so type being a pointer type should be supported.