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