From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25784 invoked by alias); 17 Nov 2004 15:11:25 -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 25761 invoked from network); 17 Nov 2004 15:11:19 -0000 Received: from unknown (HELO hotmail.com) (64.4.56.42) by sourceware.org with SMTP; 17 Nov 2004 15:11:19 -0000 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 17 Nov 2004 07:11:18 -0800 Received: from 194.201.204.121 by by101fd.bay101.hotmail.msn.com with HTTP; Wed, 17 Nov 2004 15:10:33 GMT X-Originating-IP: [194.201.204.121] X-Originating-Email: [alex_bond76@hotmail.com] X-Sender: alex_bond76@hotmail.com From: "Alex Bond" To: gcc-help@gcc.gnu.org Bcc: Subject: C++ porting to GCC problem Date: Wed, 17 Nov 2004 15:11:00 -0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 17 Nov 2004 15:11:18.0625 (UTC) FILETIME=[B08BCD10:01C4CCB7] X-SW-Source: 2004-11/txt/msg00114.txt.bz2 Hi, I'm porting some C++ originally written in Visual Studio to GCC. I've hit one snag that I can't explain and I'd like to get some help please! The following bit of code is a simplified version of the full code, but it replicates the essential form of the problem exactly. When using g++ (v3.3.3 on Cygwin or v3.2 on Redhat) with no extra command line options, it produces a parse error at the indicated line. However when compiled under Borland 6 or SGI MIPs (with their ANSI switches turned on) it compiles with no whinges and produces the right output (the number 2) when run. Is this an illegal bit of syntax permitted by other compilers (I promise that there is a good reason for this structure in the original program!), or is it a g++ thing? Thanks in advance #include using namespace std; /*------------------------------------*/ class A { public: enum Fish { Carp, Haddock, Cod }; }; /*------------------------------------*/ template class Z { public: Z(){} int MakeFish() { T::Fish theFish = T::Cod; <-------------Parse error here before ";" cout << theFish << endl; return 0; } }; /*------------------------------------*/ int main() { Z hello; hello.MakeFish(); return 0; }