Typedefs to references fix for the compactdefaultargs feature

Fixes error: SwigType_del_reference applied to non-reference type
This commit is contained in:
William S Fulton 2024-11-01 17:46:56 +00:00
parent 936767da8e
commit 5c2e83dd1a
3 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.4.0 (in progress)
===========================
2024-11-01: wsfulton
Fix internal error handling parameters that are typedefs to references
when using the compactdefaultargs feature.
2024-10-30: wsfulton
#1851 Fix handling of parameters with default arguments that are
initializer lists when using -keyword or the compactdefaultargs option.

View File

@ -31,6 +31,9 @@ public:
Defaults2(int a = PRIVATE_DEFAULT) {}
double ret(double d = PUBLIC_DEFAULT) { return d; }
double nodefault(int x) { return x; }
typedef const Defaults1& ConstDefaults1;
void references(const Defaults1& d10 = Defaults1(10), ConstDefaults1 d20 = Defaults1(20)) {}
};
%}

View File

@ -229,7 +229,7 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
SwigType *pt = Getattr(p, "type");
if ((SwigType_type(pt) != T_VOID)) {
String *local = 0;
String *type = Getattr(p, "type");
SwigType *type = SwigType_typedef_resolve_all(pt);
/* default values only emitted if in compact default args mode */
String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0;