[C++-sig] unnamed enum bug

Roman Yakovenko roman.yakovenko at actimize.com
Mon Apr 26 08:03:14 CEST 2004


Hi. I know that this issue was raised a few month ago. I want to come back to this issue.
The reason is simple: I found bug in pyste.

Description: in header file I have 2 or more unnamed enums.

namespace shared_consts{
    enum{ CHANNEL_DIRECTION_ENUM_SIZE = 3 };
    enum{ CHANNEL_FIELD_TYPE_ENUM_SIZE = 3 };
}

After generation I get next code

    enum_< py::UniqueInt<-1292127665> >("unnamed")
        .value("CHANNEL_DIRECTION_ENUM_SIZE", shared_consts::CHANNEL_DIRECTION_ENUM_SIZE)
        .export_values()
    ;

    enum_< py::UniqueInt<-1292127665> >("unnamed")
        .value("CHANNEL_FIELD_TYPE_ENUM_SIZE", shared_consts::CHANNEL_FIELD_TYPE_ENUM_SIZE)
        .export_values()
    ;

As you can see there is an attempt to register same class enum_ twice, every time with different definition.
I am working with boost 1.31 and pyste from CVS. ( I get assertion error in registry.cpp file, registry::insert function )

Why we could not export unnamed enums as constants ? 
This will also solve other small problem - repeating definition of "template<int num> struct UniqueInt"
each time pyste meats unnamed enum. I already have patch for doing this.

Roman






More information about the Cplusplus-sig mailing list