FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.bugs / 900119_01.C
blob3c93c5259971fcf70d9b98a2c256c0b93ea153df
1 // g++ 1.36.1 bug 900119_01
3 // g++ allows initializers to be included in the declaration of members
4 // of classes, structs, unions (even when -pedantic is used).
6 // This is not allowed by the C++ 2.0 Reference Manual or by Cfront 2.0.
8 // keywords: member declaration, member initialization
10 int global_int;
12 class class0 {
13 public:
14   int class0_member_0 = 99;                     /* ERROR -  */
15   static int class0_member_1 = 99;              /* ERROR -  */
16   int &class0_member_2 = global_int;            /* ERROR -  */
18   class0 () : class0_member_2 (global_int) { }  /* ERROR -  */
22 struct struct0 {
23   int struct0_member_0 = 99;                    /* ERROR -  */
24   static int struct0_member_1 = 99;             /* ERROR -  */
25   int &struct0_member_2 = global_int;           /* ERROR -  */
27   struct0 () : struct0_member_2 (global_int) { } /* ERROR -  */
30 // g++ does not allow unions to have more than one member with an initializer
32 union union0 {
33   int union0_member_0 = 99;                     /* ERROR -  */
36 union union1 {
37   //static int union1_member_0 = 99;            /* definitely illegal (9.5) */
40 union union2 {
41   int &union2_member_0 = global_int;            /* ERROR -  */
43   union2 () : union2_member_0 (global_int) { }  /* ERROR -  */
46 int main () { return 0; }