Topic: Use of class-declared enums outside of that class


Author: palmer@mwunix.mitre.org (Forrest Palmer)
Date: 13 Feb 91 19:30:55 GMT
Raw View
Hi,

  This example is based on one given in the ARM pp. 240-241 :

class X {
public:

   enum E2 { a2, b2 };
   X() {}
} ;

main ()
{
   X::E2 e2 = X::a2 ;
}


With Sun C++ 2.0 I get the error messages :

 "Ctest.C", line 10: error: `;' missing after statement
 "Ctest.C", line 10: error: syntax error

With G++ 1.37 I get :

 Ctest.C: In function int main ():
 Ctest.C:10: field `E2' is not a member of type `X'
 Ctest.C:10: parse error before `e2'
 2 errors

My question is - are these responses bugs and if so are they known bugs?
Thanks,
--
Forrest Palmer                        (703) 883-5668
The MITRE Corp. - Washington Center
MS W425, McLean, VA 22102
palmer@mitre.org
--
Forrest Palmer                        (703) 883-5668
The MITRE Corp. - Washington Center
MS W425, McLean, VA 22102
palmer@mitre.org