[C++-sig] Pyste bug: implicit constructors

Nicodemus nicodemus at esss.com.br
Thu Feb 10 22:14:13 CET 2005


Niall Douglas wrote:

>Referring to v1.32. If you have a struct like this:
>
>struct FXProcess
>{
>  struct Foo
>  {
>    int foo;
>  };
>};
>
>... and you feed it to pyste, pyste gives:
>
>class_< FXProcess::Foo, boost::noncopyable >("Foo", no_init)
>
>And that's not correct obviously. Looking at the GCC-XML output:
>
><Constructor id="_844" name="Foo" artificial="1" context="_451" 
>mangled="_ZN2FX9FXProcess14FooC1ERKS1_ *INTERNAL*" location="f0:154" 
>file="f0" line="154">
>  <Argument name="_ctor_arg" type="_987" /> 
>  </Constructor>
>
>Now the problem becomes in pyste, GCCXMLParser.py:
>
>        artificial = element.get('artificial', False)
>        if not artificial:
>            ctor = Constructor(name, classname, params, visib)
>        else:
>            # we don't want artificial constructors
>            ctor = Unknown('__Unknown_Element_%s' % id)
>
>Since the artificial flag is 1, Constructor() never gets called and 
>thus pyste generating the boost::noncopyable.
>
>I suggest:
>
>        artificial = element.get('artificial', False)
>        ctor = Constructor(name, classname, params, visib)
>        if artificial and not ctor.IsCopy():
>            # we don't want artificial constructors except copy ones
>            ctor = Unknown('__Unknown_Element_%s' % id)
>
>... but this may not be the right thing either.
>  
>

Hi Niall,

Sorry for taking so long to respond! I'll take a look at this issue in 
the weekend.

Thanks,
Nicodemus.



More information about the Cplusplus-sig mailing list