SWIG: GCC compile errors with unsigned char when using the compactdefaultargs or kwargs feature

Terry Barnaby <[email protected]>
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
Hi,

I have an error appearing during compilation of the SWIG output file 
when I try to use either or both of the "compactdefaultargs" and 
"kwargs" features when using unsigned char's.

This is with swig-4.0.1-3.fc31.src.rpm and GCC 9.3.1 on Fedora31.

I get the GCC error:

bds_wrap.cpp: In function ‘PyObject* _wrap_new_BArrayBUInt8(PyObject*, 
PyObject*, PyObject*)’:
bds_wrap.cpp:2947:40: error: expected primary-expression before ‘unsigned’
  2947 |   unsigned char arg1 = (unsigned char) unsigned char() ;

A simple example is shown below. If I use single keyword types like 
"int", "char" all is fine.

Any idea what I am doing wrong (G++ options or is this a bug in SWIG ) ?

Terry

/*******************************************************************************
  *    Test1.swig    Shows an error
  *******************************************************************************
  */
%module bdslib

%feature("compactdefaultargs");
%feature("kwargs");

%{
#include <stdint.h>

template <class T> class BArray {
public:
     BArray(T value = T());
};

%}

%include "stdint.i"

template <class T> class BArray {
public:
     BArray(T value = T());
};

%template(BArrayBUInt8) BArray<uint8_t>;



_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.