Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: Local typedef possible? Message-ID: <780@taumet.com> Date: 23 Jun 91 15:02:00 GMT References: <1991Jun22.182615.16885@murdoch.acc.Virginia.EDU> Organization: Taumetric Corporation, San Diego Lines: 32 ecl2v@opal.cs.Virginia.EDU (Edmond C. Loyot) writes: >The ARM says that what you want to do is legal. Consider this example from >page 189 of the ARM: [ example of typedef in a class ] >However when I run it through my 2.0 C++ compiler, it does not flag the error. >I think this is a throwback to the days of 1.2 when type names >(including classes) declared in a class where in the global scope... Nested types were introduced with version AT&T C++ 2.1. Up through 2.0, a type defined in a class was exported to the outer scope. In fact, AT&T 2.1 is a compromise between local and exported interpretation of nested types. AT&T 2.1 example: struct A { ... struct B { ... }; // exported to global }; struct B { ... }; // ERROR -- B already defined struct E { ... }; struct D { ... struct E { ... }; // local to D }; I assume this compromise is to allow existing code to continue to work, while allowing new code with nested types to be written. What I show in this example violates both the ARM and earlier language definitions! The ARM is for the post-2.1 brave new world. -- Steve Clamage, TauMetric Corp, steve@taumet.com