1 // g++ 1.36.1 bug 900121_05 2 3 // g++ allows unions to have base types (i.e. to be "derived") and it allows 4 // other types to have unions as base types. Both cases are illegal. 5 6 // g++ curently does not detect such errors. 7 8 // Cfront 2.0 passes this test. 9 10 // keywords: unions, inheritance 11 12 struct s0 { 13 int s0_member; 14 }; 15 16 union u0 : public s0 { /* ERROR - union has base class */ 17 int u0_member_0; 18 int u0_member_1; 19 }; 20 21 union u1 { 22 int u1_member_0; 23 int u1_member_1; 24 }; 25 26 struct s1 : public u1 { /* ERROR - base class is a union */ 27 int s1_member_0; 28 }; 29 main()30int main () { return 0; } 31