home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / std / cplus / 890 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  1.2 KB

  1. Path: sparky!uunet!mcsun!corton!seti!goudurix.inria.fr!edelson
  2. From: daniel.edelson@inria.fr (Daniel R. Edelson)
  3. Newsgroups: comp.std.c++
  4. Subject: name of class as name of nonconstructor member
  5. Message-ID: <4011@seti.UUCP>
  6. Date: 21 Jul 92 12:12:23 GMT
  7. Sender: news@seti.UUCP
  8. Reply-To: Daniel R. Edelson <daniel.edelson@inria.fr>
  9. Organization: INRIA -- Institut National de Recherche en Informatique et Automatique -- Rocquencourt, France
  10. Lines: 27
  11.  
  12. I think the following code is illegal, but am not
  13. certain the draft Standard contains a prohibition.
  14.  
  15.    struct S {
  16.     int S;
  17.    };
  18.  
  19. Without explicitly discussing this case (as far as I have
  20. discovered), I think the draft Standard forbids this for the
  21. following reason.
  22.  
  23.     Whether or not the user declares one, S has a
  24.     constructor. There may not be an outline function
  25.     emitted, but S::S() can be called. Therefore, the
  26.     declaration of "int S" redeclares as a datum an
  27.     identifier that is already declared in the same 
  28.     scope to be a function.
  29.  
  30. I don't consider this argument completely waterproof. 
  31. If someone can phrase it more convincingly, I'd appreciate 
  32. hearing the argument.
  33.  
  34. Thanks a bunch,
  35. Daniel 
  36. daniel.edelson@inria.fr
  37.  
  38.     
  39.