home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!darwin.sura.net!uvaarpa!cv3.cv.nrao.edu!cv3!dschieb
- From: dschieb@muse.cv.nrao.edu (Darrell Schiebel)
- Subject: Template Quirk (Sun cfront/3.0 compiler)
- Message-ID: <DSCHIEB.93Jan12150130@muse.cv.nrao.edu>
- Sender: news@nrao.edu
- Organization: National Radio Astronomy Observatory
- Distribution: comp
- Date: Tue, 12 Jan 1993 20:01:30 GMT
- Lines: 40
-
-
- I've run into a curious problem which must be a bug in the Sun
- cfront 3.0.1 based compiler. Below I have a test program
- which works as expected. However, if the inline function, "id",
- is changed to define its body within the class, i.e. the commented
- out line, it fails with the following errors:
-
- "dum5.C", line 8: error: qualified name A:: name not found in fx
- "dum5.C", line 8: error detected during the instantiation of fx <A>
- "dum5.C", line 16: is the site of the instantiation
-
- Anyone else ran into the "feature"?? Any ideas where the
- compiler is going astray??
-
- thanks,
- Darrell Schiebel
- -------------------X-----X-----X-----X-----X-----X---------------------
- #include <iostream.h>
- #include <string.h>
-
- class FX {};
- template<class t> class fx : public FX{
- public:
- fx *dup() {return(new fx());}
- fx() {cout << "fx - " << t::name() << endl;}
- };
-
- class A {
- public:
- static const char *name() {return("A");}
- //const FX *id() {return(new fx<A>());}
- inline const FX *id();
- };
- inline const FX *id() {return(new fx<A>());}
-
- main() {
-
- fx<A> f;
-
- }
-