Menu

#12 Default constructor assumed when non present

closed
Roman
None
5
2008-10-20
2008-06-03
Mike Wilson
No

Hi

Giving GCCXML the following header file

struct TEvent
{
template <class C>
TEvent(C& clss);
};

I get

<?xml version="1.0"?>
<GCC_XML cvs_revision="1.121">
<Namespace id="_1" name="::" members="_3 _2 _4 " mangled="_Z2::" demangled="::"/>
<Namespace id="_2" name="std" context="_1" members="" mangled="_Z3std" demangled="std"/>
<Namespace id="_3" name="__cxxabiv1" context="_1" members="" mangled="_Z10__cxxabiv1" demangled="__cxxabiv1"/>
<Struct id="_4" name="TEvent" context="_1" mangled="6TEvent" demangled="TEvent" location="f0:2" file="f0" line="2" artificial="1" size="8" align="8" members="" bases=""/>
<File id="f0" name="./Header6.h"/>
</GCC_XML>

In an earlier version og GCC-XML I get

<?xml version="1.0"?>
<GCC_XML>
<Namespace id="_1" name="::" members="_3 " mangled="_Z2::"/>
<Namespace id="_2" name="std" context="_1" members="" mangled="_Z3std"/>
<Struct id="_3" name="TEvent" context="_1" mangled="6TEvent" location="f0:2" file="f0" line="2" members="_4 " bases=""/>
<Constructor id="_4" name="TEvent" artificial="1" throw="" context="_3" mangled="_ZN6TEventC1ERKS_ *INTERNAL* " location="f0:2" file="f0" line="2">
<Argument name="_ctor_arg" type="_5"/>
</Constructor>
<ReferenceType id="_5" type="_3c"/>
<CvQualifiedType id="_3c" type="_3" const="1"/>
<File id="f0" name="Header6.h"/>
</GCC_XML>

When supplying the header file to Py++, I get from using my latest GCC-XML
BOOST_PYTHON_MODULE(pyplusplus){
bp::class_< TEvent >( "TEvent" );
}
when my earlier one gives
BOOST_PYTHON_MODULE(pyplusplus){
bp::class_< TEvent, boost::noncopyable >( "TEvent", bp::no_init );
}
The latter is correct, as there is no default constructor for TEvent.

I submiited this bug report to GCC-XML and it appears the XML format has changed, hence the error in Py++?

In passing can I say thank you for this tool.

Discussion

  • Mike Wilson

    Mike Wilson - 2008-06-04

    Logged In: YES
    user_id=2106901
    Originator: YES

    This issue may have been fixed in the latest GCC-XML version.
    Please see

    http://www.gccxml.org/Bug/bug_view_advanced_page.php?bug_id=7148

     
  • Roman

    Roman - 2008-06-05

    Logged In: YES
    user_id=1084190
    Originator: NO

    Thanks for bug reporting. I already took new version of GCC-XML and few my tests failed. I hope to fix this problem in next few days.

    The possible work-around could be to remove all constructors from the class and to set its "noncopyable" property to True:

    cls = mb.class_( ... )
    for c in cls.constructors(recursive=False):
    cls.remove_declaration( c )

    after this be sure to call to

    mb.run_query_optimizer()

    otherwise it is possible you will get some strange errors

     
  • Mike Wilson

    Mike Wilson - 2008-06-05

    Logged In: YES
    user_id=2106901
    Originator: YES

    I have just rebuilt GCCXML (cvs release 1.122) and ran simple and more complicated test - they both worked fine.
    (Are you saying you still get this error with this release (1.122) of GCCXML?).

    Thanks for the possible work-around - it at least provides me with some ideas on how to customise my output. (My quick solution was to just add 'private: TEvent();' , but I've removed this now).

     
  • Roman

    Roman - 2008-06-26

    Logged In: YES
    user_id=1084190
    Originator: NO

    Mike, I think I fixed this bug. In order to enjoy from it, you will have to checkout latest version of GCCXML, pygccxml and Py++ projects.

    P.S. It took so much time, because there were few problems in GCCXML and the fix was not so trivial.

     
  • Mike Wilson

    Mike Wilson - 2008-06-27

    Logged In: YES
    user_id=2106901
    Originator: YES

    Thank you Roman.

    I've got another problem at the mo, but will at least try & download the latest versions as you suggest. I assume you are aware of another GCCXML update - I was going to e-mail you but never got round to it.

    Mike

     
  • Roman

    Roman - 2008-10-20
    • assigned_to: nobody --> roman_yakovenko
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.