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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [cvt1.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do assemble  }
2
// GROUPS passed conversions
3
#include 
4
 
5
class Thing
6
{
7
public:
8
      typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" "comma" { target c++98 } }
9
        Thing (ThingType type) : thingType (type) { }
10
        ~Thing () { }
11
private:
12
        ThingType thingType ;
13
} ;
14
 
15
class Group
16
{
17
public:
18
      typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" "comma" { target c++98 } }
19
        Group (GroupType type) : groupType (type), groupCount (0) { }
20
        ~Group () { }
21
        void append (Thing* const &entry) { groupCount ++ ; }
22
        operator GroupType () const { return groupType ; }
23
        operator int () const { return groupCount ; } // remove this and problem gone
24
 
25
private:
26
        int groupCount ;
27
        GroupType groupType ;
28
} ;
29
 
30
inline Group& operator += (Group& g, Thing* const t)
31
{
32
        g.append (t) ;
33
        return g ; // complaint is here
34
}
35
 
36
int
37
main (int argc, char** argv)
38
{
39
        Group g (Group::THIS_GROUP) ;
40
 
41
        g += new Thing (Thing::GOOD_THING) ;
42
        std::cout << "Group type is " << (Group::GroupType) g << std::endl ;
43
        return 0 ;
44
}

powered by: WebSVN 2.1.0

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