Archived

This forum has been archived. Please start a new discussion on GitHub.

PointerType Bug

I just created a slice file that produces C++ code that does not compile. The offending slice code is this:
class Type;
class PointerType extends Type
{
Type otherType;
};

The generated C++ code looks like this:
class PointerType : virtual public ::Type
{
public:

typedef PointerTypePrx ProxyType;
typedef PointerTypePtr PointerType;

//....
}

My gcc compiler produces an error like this:
error: ISO C++ forbids nested type ‘PointerType’ with same name as enclosing class
error: PointerType::PointerType’ has the same name as the class in which it is declared

This isn't a huge deal, I can just rename the class.

However, slice2cpp should probably catch this. This would also be the case if one named the slice class "ProxyType".

This happens with slice2cpp 3.3.1 on:
Linux 2.6.31-19-generic-pae #56-Ubuntu SMP Thu Jan 28 02:29:51 UTC 2010 i686 GNU/Linux

Comments

  • mes
    mes California
    Hi Reid,

    Thanks for reporting this. Ideally the generated code should not use symbols that could conflict with Slice type names.

    Regards,
    Mark