From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14421 invoked by alias); 22 Apr 2003 16:34:04 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 14402 invoked from network); 22 Apr 2003 16:34:03 -0000 Received: from unknown (HELO mailoff.mtu.edu) (141.219.70.111) by sources.redhat.com with SMTP; 22 Apr 2003 16:34:03 -0000 Received: from node2. (node2.mtu.edu [141.219.68.102]) by mailoff.mtu.edu (8.11.6+Sun/8.11.4) with ESMTP id h3MGXxu13560; Tue, 22 Apr 2003 12:33:59 -0400 (EDT) Received: from node25 (node25.mtu.edu [141.219.68.125]) by node2. (8.11.6/8.11.6) with ESMTP id h3MGXtm03997; Tue, 22 Apr 2003 12:33:55 -0400 Received: from campus4.mtu.edu ([141.219.70.7]) by node25 (MailMonitor for SMTP v1.2.1 ) ; Tue, 22 Apr 2003 12:33:55 -0400 (EDT) Received: from node2. (node2.mtu.edu [141.219.68.102]) by mail.mtu.edu (8.11.6+Sun/8.11.6) with ESMTP id h3MGXw228694; Tue, 22 Apr 2003 12:33:58 -0400 (EDT) Received: from btdgrad-pc4.ee.mtu.edu (btdgrad-pc4.ee.mtu.edu [141.219.21.170]) by node2. (8.12.8/8.12.3/auth_ssl.mc v1.0) with ESMTP id h3MGXtm2003986; Tue, 22 Apr 2003 12:33:55 -0400 Subject: template(s) declaration with GCC3.2-7 From: Rade Trimceski To: gcc-help@gcc.gnu.org Content-Type: text/plain Organization: Message-Id: <1051029237.1085.36.camel@Vaio> Mime-Version: 1.0 Date: Tue, 22 Apr 2003 16:34:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2003-04/txt/msg00195.txt.bz2 Hey guys (and girls if there are any) :) I'm trying to compile code that was written a while ago, and compiled just fine with gcc 2.96. GCC 3.2-7 doesn't like it at all. Here's the code as I extracted it from the header file: [rtrimces@Vaio tests]#cat template_test.cpp #include template class LsList : public list<_Tp> { public: typedef list<_Tp> baseList; LsList() : baseList() {} LsList(const _Tp& x) : baseList(1, x) {} void eraseAll() { baseList::erase(begin(), end()); } LsList<_Tp>& operator= (const LsList<_Tp> & x) { return (LsList<_Tp> &)baseList::operator= (x); } }; When trying to compile I get the following errors: [rtrimces@Vaio tests]# g++ -o template.o template_test.cpp template_test.cpp:4: parse error before `<' token template_test.cpp:7: ISO C++ forbids declaration of `LsList' with no type template_test.cpp: In function `int LsList()': template_test.cpp:7: `int LsList()' redeclared as different kind of symbol template_test.cpp:4: previous declaration of `template class LsList' template_test.cpp:4: previous non-function declaration `template class LsList' template_test.cpp:7: conflicts with function declaration `int LsList()' template_test.cpp:7: only constructors take base initializers template_test.cpp:7: confused by earlier errors, bailing out Can someone tell me what has changed with the compiler and why this code doesn't compile anymore? Even better answer would be how should I write this code in order to make it compile with gcc 3.2. Thanks a lot! Rade P.S. In case you are wondering: [rtrimces@Vaio tests]# g++ --version g++ (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)