home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18797 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  1.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!bs
  2. From: bs@alice.att.com (Bjarne Stroustrup)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: About class template names
  5. Message-ID: <24568@alice.att.com>
  6. Date: 7 Jan 93 16:01:42 GMT
  7. Article-I.D.: alice.24568
  8. References: <C0H9sA.BGw@newsserver.technet.sg>
  9. Organization: AT&T Bell Laboratories, Murray Hill NJ
  10. Lines: 24
  11.  
  12.  
  13.  
  14. arthur@solomon.technet.sg (Arthur Sombrito) writes
  15.  
  16.  > Hi,
  17.  > 
  18.  > According to the ARM, a class template name must be unique in a program
  19.  > and may not be declared to refer to any other template, class, function,
  20.  > object, value, or type in the same scope.
  21.  > 
  22.  > Does this mean that a name previously used as a class template name
  23.  > can't be reused in another scope? For example:
  24.  > 
  25.  >    template <class T> class U {};
  26.  >    enum U {};    // This should be an error. I am wondering why GNU
  27.                  // and Borland accepted this.
  28.  
  29. They shouldn't accept it. 
  30.  
  31.  >    f() {
  32.  >      union U {}; // So is this an error?
  33.  >    }
  34.  
  35. No. That's OK. U is not in the global scope and hides the global U within f().
  36.