home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13636 < prev    next >
Encoding:
Text File  |  1992-09-14  |  1.2 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!ux1.cso.uiuc.edu!usenet.ucs.indiana.edu!nsundare@silver.ucs.indiana.edu
  3. From: Neelakantan Sundaresan <nsundare@silver.ucs.indiana.edu>
  4. Subject: friend classes of template classes
  5. Message-ID: <BuLA7w.HIt@usenet.ucs.indiana.edu>
  6. Sender: <nsundare@silver.ucs.indiana.edu>
  7. Organization: Indiana University
  8. Date: Mon, 14 Sep 1992 22:23:51 GMT
  9. X-Mailer: ELM [version 2.3 PL11]
  10. Lines: 28
  11.  
  12.  
  13. I am having problems compiling a friend class of a template class when
  14. it accesses a member of the friend class accesses a type defined in the
  15. template of which it is a friend. 
  16. ----
  17.      template <class T> class U
  18.      {
  19.         private:
  20.            enum error { i, j, k};
  21.            friend class W;
  22.         public:....
  23.      };
  24.      class W
  25.      {
  26.         int error_fn(U::error);
  27.                      ^^^ point where the compiler needs an instantiation
  28.                             of the template.
  29.      };
  30. Even if I give it an instantiation of the template as U<X> (where X is
  31. some defined class), the compiler screams saying size unknown.
  32. -----
  33.  
  34. Any hints as to what I am doing wrong?
  35. thanks
  36. Neel.
  37. PS: This is with the CC translator.
  38.      
  39.  
  40.