|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Regression in SWIG 1.3.39Hello,
after upgrading from 1.3.36 my wrappers broke, caused by the change below: http://swig.svn.sourceforge.net/viewvc/swig/trunk/Lib/swig.swg?r1=11006&r2=11007 in particular the removal of SwigValueWrapper(const T& t) . I am wrapping a function like void func( MySmartPtr<SomeType> someParameter = 0 ); Which causes code like SwigValueWrapper< MySmartPtr< SomeType > > arg1 = (SwigValueWrapper< MySmartPtr< SomeType > >) 0 ; to be generated. This fails (under msvc 2008) with an error like error C2440: 'conversion': cannot convert from 'int' to 'SwigValueWrapper<T>' This is obvious, as only the constructor of MySmartPtr accepts 0, the constructor of SwigValueWrapper doesn't accept 0 as a constructor argument. Unless there's a compelling reason against this, I vote to reintroduce the SwigValueWrapper(const T& t) constructor. Thanks, -Matthias ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Regression in SWIG 1.3.39Nitro wrote:
> Hello, > > after upgrading from 1.3.36 my wrappers broke, caused by the change below: > > http://swig.svn.sourceforge.net/viewvc/swig/trunk/Lib/swig.swg?r1=11006&r2=11007 > > in particular the removal of SwigValueWrapper(const T& t) . > > I am wrapping a function like > > void func( MySmartPtr<SomeType> someParameter = 0 ); > > Which causes code like > > SwigValueWrapper< MySmartPtr< SomeType > > arg1 = (SwigValueWrapper< > MySmartPtr< SomeType > >) 0 ; > > to be generated. This fails (under msvc 2008) with an error like > > error C2440: 'conversion': cannot convert from 'int' to > 'SwigValueWrapper<T>' > > This is obvious, as only the constructor of MySmartPtr accepts 0, the > constructor of SwigValueWrapper doesn't accept 0 as a constructor argument. > > Unless there's a compelling reason against this, I vote to reintroduce the > SwigValueWrapper(const T& t) constructor. > SwigValueWrapper. Please provide a standalone example to reproduce and then I'll look at reintroducing it. William ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Regression in SWIG 1.3.39Am 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. ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Regression in SWIG 1.3.39Nitro 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. 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 |
| Free embeddable forum powered by Nabble | Forum Help |