OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [cvt1.C] - Rev 154

Go to most recent revision | Compare with Previous | Blame | View Log

// { dg-do assemble  }
// GROUPS passed conversions
#include <iostream>

class Thing
{
public:
      typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" } comma
        Thing (ThingType type) : thingType (type) { }
        ~Thing () { }
private:
        ThingType thingType ;
} ;

class Group
{
public:
      typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" } comma
        Group (GroupType type) : groupType (type), groupCount (0) { }
        ~Group () { }
        void append (Thing* const &entry) { groupCount ++ ; }
        operator GroupType () const { return groupType ; }
        operator int () const { return groupCount ; } // remove this and problem gone

private:
        int groupCount ;
        GroupType groupType ;
} ;

inline Group& operator += (Group& g, Thing* const t)
{
        g.append (t) ;
        return g ; // complaint is here
}

int
main (int argc, char** argv)
{
        Group g (Group::THIS_GROUP) ;

        g += new Thing (Thing::GOOD_THING) ;
        std::cout << "Group type is " << (Group::GroupType) g << std::endl ;
        return 0 ;
}

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.