X-Authentication-Warning: ieva01.lanet.lv: pavenis owned process doing -bs Date: Tue, 21 Sep 1999 10:04:49 +0300 (WET) From: Andris Pavenis To: Jari Karppinen cc: djgpp AT delorie DOT com Subject: Re: Trouble with templates and gcc-2.95 In-Reply-To: <7s586n$k60$1@ousrvr3.oulu.fi> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 20 Sep 1999, Jari Karppinen wrote: > I wrote a simple templatized vector class. There was no trouble > compiling the source with egcs-1.1.2, but after I switched to > gcc-2.95, I got the following: > > vec.cc: In instantiation of `Vector': > vec.cc:285: instantiated from here > vec.cc:44: invalid use of undefined type `class Vector' > vec.cc:48: forward declaration of `class Vector' > vec.cc:44: confused by earlier errors, bailing out > > I made no changes to the source, and can't see why this happens. I would > really appreciate advice from experts. I cannot answer why this happens. At least I have verified in Linux that it's so (gcc-2.95.1 gives errors, egcs-2.91.66.1 compiles Ok). It's known that newer versions of gcc does more strict syntactical checking of source and as result there may be problems. Use of option -fpermissive to turn off default -fpedantic-errors for C++ compiler also doesn't help in this case. I suggest making smaller test example (to be more sure somebody will take a look at it) and to ask a question in gcc mailing list (gcc AT gcc DOT gnu DOT org). Andris