Topic: Interpretation of nested scope rules for class declarations


Author: ngdp@cabernet.newcastle.ac.uk (Graham D. Parrington)
Date: 12 Sep 90 14:11:44 GMT
Raw View
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