// { dg-do assemble }
|
// { dg-do assemble }
|
// GROUPS passed conversions
|
// GROUPS passed conversions
|
#include
|
#include
|
|
|
class Thing
|
class Thing
|
{
|
{
|
public:
|
public:
|
typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" } comma
|
typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" } comma
|
Thing (ThingType type) : thingType (type) { }
|
Thing (ThingType type) : thingType (type) { }
|
~Thing () { }
|
~Thing () { }
|
private:
|
private:
|
ThingType thingType ;
|
ThingType thingType ;
|
} ;
|
} ;
|
|
|
class Group
|
class Group
|
{
|
{
|
public:
|
public:
|
typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" } comma
|
typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" } comma
|
Group (GroupType type) : groupType (type), groupCount (0) { }
|
Group (GroupType type) : groupType (type), groupCount (0) { }
|
~Group () { }
|
~Group () { }
|
void append (Thing* const &entry) { groupCount ++ ; }
|
void append (Thing* const &entry) { groupCount ++ ; }
|
operator GroupType () const { return groupType ; }
|
operator GroupType () const { return groupType ; }
|
operator int () const { return groupCount ; } // remove this and problem gone
|
operator int () const { return groupCount ; } // remove this and problem gone
|
|
|
private:
|
private:
|
int groupCount ;
|
int groupCount ;
|
GroupType groupType ;
|
GroupType groupType ;
|
} ;
|
} ;
|
|
|
inline Group& operator += (Group& g, Thing* const t)
|
inline Group& operator += (Group& g, Thing* const t)
|
{
|
{
|
g.append (t) ;
|
g.append (t) ;
|
return g ; // complaint is here
|
return g ; // complaint is here
|
}
|
}
|
|
|
int
|
int
|
main (int argc, char** argv)
|
main (int argc, char** argv)
|
{
|
{
|
Group g (Group::THIS_GROUP) ;
|
Group g (Group::THIS_GROUP) ;
|
|
|
g += new Thing (Thing::GOOD_THING) ;
|
g += new Thing (Thing::GOOD_THING) ;
|
std::cout << "Group type is " << (Group::GroupType) g << std::endl ;
|
std::cout << "Group type is " << (Group::GroupType) g << std::endl ;
|
return 0 ;
|
return 0 ;
|
}
|
}
|
|
|