Re: Why this results in Error: Syntax error in input(3).
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <[email protected]> |
> On 31. Dec 2021, at 15.47, William S Fulton <[email protected]> wrote: > > SWIG can parse the conversion operator to bool: > explicit operator bool () const > but not the fallback conversion operator to a member function returning Standard_Transient* (I think that is what it is!!): > operator Standard_Transient* handle::* () const > > I've never seen the latter which looks horrendous to parse and I can't see it making much sense returning this for a language wrapper, so don't hold your breath for it to be supported anytime soon in SWIG. I suggest adding SWIG to list of compilers that supports the bool conversion operator. > > When you instantiate this class with %template, you'll get a warning: > Warning 503: Can't wrap 'operator bool' unless renamed to a valid identifier. > > So add in something like the following if you want to wrap this conversion operator: > %rename(tobool) operator bool; > > There is more info on conversion operator work we're looking at in https://github.com/swig/swig/issues/2098 <https://github.com/swig/swig/issues/2098>. > > William Ah, thanks, I got my #if/#else thinking the wrong way round! No wonder I was confused ;) When you say "adding SWIG to list of compilers that supports the bool conversion operator.", is that just suggestion to modify the code or is there somewherea actually a list of compilers supporting boolean. wbr Kusti _______________________________________________ Swig-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/swig-user