[GCC-XML] wrong artificial op=()

Roman Yakovenko roman.yakovenko at gmail.com
Sat Oct 4 15:01:29 EDT 2008


On Wed, Oct 1, 2008 at 6:35 PM, Axel Naumann <Axel.Naumann at cern.ch> wrote:
> Hi Brad,
>
> On 2008-10-01 17:15, Brad King wrote:
>>> the XML file contains an artificial operator=() for the classes S, T, V, and W.
>>> This assignment operator should not exist according to the standard
>>> [class.copy], 12.8.12. Both GCC 4.3 and MSVC 9.0 will refuse to compile code
>>> that requires the implicit definition of these operators:
>> [snip]
>>> Could these operators be suppressed, please?
>>
>> I've come up with a hack that pretends these artifical methods are
>> called, suppresses any resulting error messages, and then discards the
>> methods if errors occurred.  It seems to work for the examples you provided.

Brad, I think there is a problem with these changes.
Consider next use case:

    struct const_item{ const int values[10]; };
    void test_const_item( const_item x = const_item() );
    struct const_container{ const const_item items[10]; };
    void test_const_container( const_container x = const_container() );

This code compiles fine with gccxml, but const_container class
description doesn't contain artificial default constructor. At the
same time, it contains default copy constructor.

I am not C++ expert, but I think the class should have default constructor.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the gccxml mailing list