home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 12983 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.9 KB

  1. Path: sparky!uunet!cs.utexas.edu!ut-emx!jamshid
  2. From: jamshid@ut-emx.uucp (Jamshid Afshar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Templates, classes, and enumeration types
  5. Summary: yes, it's a BC++ 3.x bug wrt nested types
  6. Message-ID: <78510@ut-emx.uucp>
  7. Date: 27 Aug 92 18:47:12 GMT
  8. References: <1992Aug26.071212.3003@ennews.eas.asu.edu>
  9. Reply-To: jamshid@emx.utexas.edu
  10. Organization: The University of Texas at Austin; Austin, Texas
  11. Lines: 36
  12.  
  13. In article <1992Aug26.071212.3003@ennews.eas.asu.edu> nwatson@enuxha.eas.asu.edu (Nathan F. Watson) writes:
  14. >[This works with BC++ 3.1:]
  15. >   template <class T> class A
  16. >   {
  17. >      public:
  18. >         enum Aenum { ... };
  19. >         void Afunc(Aenum v) { ... }
  20. >   }
  21. >
  22. >But no combination I have tried so far works outside the class definition.
  23. >The best I can come up with is:
  24. >
  25. >   template <class T> void A<T>::Afunc(A<T>::Aenum v) { ... }
  26. >
  27. >How should I do this?  Is this a BC++3.1 bug?
  28.  
  29. Yes it's a BC++ bug since 3.0 (which I reported in Dec.91!).  The only
  30. thing I'm not sure of is whether the "A<T>::" qualifier is required in
  31. the parameter list (but it certainly shouldn't hurt).  If Aenum were
  32. the return type, then a qualifier probably would be required, but I
  33. think once it hits "A<T>::funcname" it's in the scope of "A<T>".
  34. Anyone have a definitive answer?
  35.  
  36. Anyway, BC++ 3.x gets very confused by nested type names (typedefs,
  37. nested classes, enums) when used outside the template class definition
  38. or when used by derived classes.  I don't know of any workaround other
  39. than defining the function inside, using the "real" type for typedefs,
  40. or moving the type definition outside the class (make Aenum global).
  41.  
  42. I send all the bugs I find to bugs@borland.com (just reports, no reply
  43. or tech. support) and to the TC++/BC++ mailing list (to subsribe,
  44. email "subscribe tcplus-l Jane Doe" to listserv@ucf1vm.cc.ucf.edu).
  45. E-mail me if you want a copy of my 3.0 or 3.1 bug reports.
  46.  
  47. Jamshid Afshar
  48. jamshid@emx.utexas.edu
  49.