Fixes for compactdefaultargs and pass by value where the class being passed by value has no default constructor - previously it used SwigValueWrapper
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11312 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
421a4419f2
commit
5d3deb2db1
3 changed files with 13 additions and 1 deletions
|
|
@ -1,6 +1,12 @@
|
||||||
Version 1.3.40 (in progress)
|
Version 1.3.40 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2009-06-24: wsfulton
|
||||||
|
Fix wrapping methods with default arguments and the compactdefaultargs feature
|
||||||
|
where a class is passed by value and is assigned a default value. The SwigValueWrapper
|
||||||
|
template workaround for a missing default constructor is no longer used as the code
|
||||||
|
generated does not call the default constructor.
|
||||||
|
|
||||||
2009-06-16: wsfulton
|
2009-06-16: wsfulton
|
||||||
[Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
|
[Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
|
||||||
Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
|
Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@
|
||||||
|
|
||||||
|
|
||||||
// tests valuewrapper
|
// tests valuewrapper
|
||||||
|
%feature("compactdefaultargs") MyClass2::set;
|
||||||
%inline %{
|
%inline %{
|
||||||
enum MyType { Val1, Val2 };
|
enum MyType { Val1, Val2 };
|
||||||
|
|
||||||
|
|
@ -134,6 +135,7 @@
|
||||||
void set(MyClass1 cl1 = Val1) {}
|
void set(MyClass1 cl1 = Val1) {}
|
||||||
// This could have been written : set(MyClass1 cl1 = MyClass1(Val1))
|
// This could have been written : set(MyClass1 cl1 = MyClass1(Val1))
|
||||||
// But it works in C++ since there is a "conversion" constructor in MyClass1.
|
// But it works in C++ since there is a "conversion" constructor in MyClass1.
|
||||||
|
void set2(MyClass1 cl1 = Val1) {}
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,11 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
|
||||||
String *type = Getattr(p, "type");
|
String *type = Getattr(p, "type");
|
||||||
/* default values only emitted if in compact default args mode */
|
/* default values only emitted if in compact default args mode */
|
||||||
String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0;
|
String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0;
|
||||||
SwigType *altty = SwigType_alttype(type, 0);
|
|
||||||
|
/* When using compactdefaultargs, the code generated initialises a variable via a constructor call that accepts the
|
||||||
|
* default value as a parameter. The default constructor is not called and therefore SwigValueWrapper is not needed. */
|
||||||
|
SwigType *altty = pvalue ? 0 : SwigType_alttype(type, 0);
|
||||||
|
|
||||||
int tycode = SwigType_type(type);
|
int tycode = SwigType_type(type);
|
||||||
if (tycode == T_REFERENCE) {
|
if (tycode == T_REFERENCE) {
|
||||||
if (pvalue) {
|
if (pvalue) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue