Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!YAHI.STANFORD.EDU!tiemann From: tiemann@YAHI.STANFORD.EDU (Michael Tiemann) Newsgroups: gnu.g++ Subject: Are Class Decl.'s Legal in Funcs ? Message-ID: <8904042214.AA07835@yahi.stanford.edu> Date: 4 Apr 89 22:14:31 GMT References: <890403-150348-4532@Xerox> Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@lurch.stanford.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 28 Swen Johnson (SJohnson.ElSegundo@Xerox.COM) asks, Is this legal? and notes that GNU C++ 1.32.0 does not handle it correctly. ------------------------------------------------------------------------- #include void func() { class My_Class { int var; public: void doit() { var = 1; cout << "var = " << var << "\n"; }; }; My_Class my_object; my_object.doit(); }; main () { func(); }; ------------------------------------------------------------------------- It is legal, and GNU C++ 1.34.2 handles this file just fine. Michael