Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!uunet!mcsun!ukc!newcastle.ac.uk!cabernet!ngdp From: ngdp@cabernet.newcastle.ac.uk (Graham D. Parrington) Newsgroups: comp.std.c++ Subject: Interpretation of nested scope rules for class declarations Message-ID: <1990Sep12.141144.24494@newcastle.ac.uk> Date: 12 Sep 90 14:11:44 GMT Sender: news@newcastle.ac.uk Organization: University of Newcastle upon Tyne, UK, NE1 7RU Lines: 33 According to E&S section 10.4 (p 216) : "the declaration of a member name hides declarations of the same name in base classes and global names" Therefore the following should (I think) be (strictly) illegal: class X { X(); ~X(); X* do_something(); } since the declaration of the constructor introduces a member named X into scope hiding X as a typename (or classname) thus making the return type of 'do_something' undefined unless elaborated as 'class X'. Is this interpretation correct? (cfront 2.1 doesn't implement it). Maybe something needs to be said along the lines of "the current class name is always a typename when delaring a class"? Comments anyone? Graham -- Graham Parrington, Computing Laboratory, University of Newcastle upon Tyne ARPA = Graham.Parrington%newcastle.ac.uk@nsfnet-relay.ac.uk UUCP = ...!ukc!newcastle.ac.uk!Graham.Parrington PHONE = +44 91 222 8067 Graham Parrington, Computing Laboratory, University of Newcastle upon Tyne ARPA = Graham.Parrington%newcastle.ac.uk@nsfnet-relay.ac.uk UUCP = ...!ukc!newcastle.ac.uk!Graham.Parrington PHONE = +44 91 222 8067