home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!think.com!zaphod.mps.ohio-state.edu!cs.utexas.edu!hellgate.utah.edu!fcom.cc.utah.edu!swillden
- From: swillden@news.ccutah.edu (Shawn Willden)
- Subject: Re: BC++ templates broken
- Message-ID: <1992Aug31.155313.5879@fcom.cc.utah.edu>
- Sender: news@fcom.cc.utah.edu
- Organization: University of Utah Computer Center
- X-Newsreader: Tin 1.1 PL3
- References: <1992Aug29.212548.8071@fcom.cc.utah.edu>
- Date: Mon, 31 Aug 92 15:53:13 GMT
- Lines: 40
-
- I'm replying to my own post.... (Since there has been an odd and somewhat ominous
- silence in response to my first :-)
-
- swillden@news.ccutah.edu (Shawn Willden) writes:
- : Hi all,
- :
- : I have discovered a problem with BC++'s templates. Given code like
- : this:
- :
- : template<class T> class A1;
- : template<class T> class A2;
- :
- : template<class T> class A { A1* a; A2* b; };
-
- Slight correction here, I meant to say:
- template<class T> class A { A1<T>* a; A2<T>* b;};
-
- : template<class T> class A1 : public A<T> {};
- : template<class T> class A2 : public A<T> {};
- :
- : main() {A1<int> myA1;}
- : [stuff deleted]
-
- gcc-2.2.2 barfs in the same way and apparently for the same reason. Except that
- BC++ does it gracefully whereas gcc has an "Internal compiler error" and dies.
- Am I asking something too difficult? It seems to me that since A contains only
- *pointers* to objects of type A1<T> and A2<T>, that the compiler should be able to
- say "Oh, okay, this is a pointer to a type that has been forward-declared, I'll
- just make the structure N bytes larger to hold a pointer there and go get the next
- token," and not *care* what the expansion is.
-
- I think I'm going to take a look at the guts of gcc and see what it would take to
- fix it (probably creating another stack of "Templates to expand when I'm done with
- my current pile of stuff to do" that will then have to be compared with "Templates
- already expanded") but that won't help me with the DOS version (which is the one
- that matters).
-
- --
- Shawn Willden
- swillden@icarus.weber.edu
-