« Return to Thread: Regression in SWIG 1.3.39

Re: Regression in SWIG 1.3.39

by wsfulton :: Rate this Message:

Reply to Author | View in Thread

Nitro wrote:

> Am 17.06.2009, 00:25 Uhr, schrieb William S Fulton
> <wsf@...>:
>
>> Nitro wrote:
>>> Unless there's a compelling reason against this, I vote to
>>> reintroduce the
>>> SwigValueWrapper(const T& t) constructor.
>>>
>> I can't get your example function above to generate the
>> SwigValueWrapper. Please provide a standalone example to reproduce and
>> then I'll look at reintroducing it.
>
> Attached is a sample which shows the problem.
>
> The swig command line is included as a comment on the very first line of
> the line. I think the crucial part is the "-keyword" flag in combination
> with the forward declaration of MyClass. If you remove any of these two
> the bug does not show up.
>
> Thanks for looking into this.
>
> -Matthias
>
> P.S.: In addition to re-adding the SwigValueWrapper(const T& t)
> constructor I also had to comment SwigValueWrapper(const
> SwigValueWrapper<T>& rhs); I am not sure if that's a good idea, but it
> made the wrapper in my original case compile and work.
Matthias, the real problem is that SwigValueWrapper is being used when
it shouldn't be used. What triggers it off is the compactdefaultargs
feature, which -keyword turns on. The code being generated is something
like:

SwigValueWrapper< MySmartPtr< MyClass > > arg1 = (SwigValueWrapper<
MySmartPtr< MyClass > >)0;

whereas if the compactdefaultargs feature is not used, the generated
code is:

SwigValueWrapper< MySmartPtr< MyClass > > arg1 ;

Clearly the 2nd case requires SwigValueWrapper to work around a missing
default constructor, whereas the first case does not call the default
constructor. Because the 1st case does not require a work around for a
missing default constructor, SwigValueWrapper should not be used. The
svn version fixes this. SwigValueWrapper should not have a copy
constructor or any other type of constructor as it should only be used
for default constructing an object.

William

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

 « Return to Thread: Regression in SWIG 1.3.39