From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23672 invoked by alias); 4 Dec 2002 10:26:05 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23658 invoked by uid 71); 4 Dec 2002 10:26:04 -0000 Date: Wed, 04 Dec 2002 02:26:00 -0000 Message-ID: <20021204102604.23657.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Volker Reichelt Subject: Re: c++/4707: g++ complains about a "typedef", but no typedefs are there Reply-To: Volker Reichelt X-SW-Source: 2002-12/txt/msg00187.txt.bz2 List-Id: The following reply was made to PR c++/4707; it has been noted by GNATS. From: Volker Reichelt To: gcc-gnats@gcc.gnu.org, dlux@dlux.dlux.hu, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: c++/4707: g++ complains about a "typedef", but no typedefs are there Date: Wed, 4 Dec 2002 12:12:14 +0100 The problem can be demonstrated with the following (illegal) code snippet: --------------------------snip here----------------------------- template struct A { void foo() { bar(T); } void bar(); } typedef int INT; --------------------------snip here----------------------------- With mainline I get the following error message: PR4707.cc: In member function `void A::foo()': PR4707.cc:3: error: parse error before `typedef' PR4707.cc: At global scope: PR4707.cc:7: error: extraneous `int' ignored PR4707.cc:7: error: template declaration of `typedef struct A INT' There are two things correct about the error message: * The bug is in the member function `void A::foo()'. * It is in line 3 (you cannot use the template parameter T like this). The rest is bogus: * The parse error happens before ")" and not before the "typedef" which comes after the end of the whole struct. You can actually place as many members between "foo" and the end of the struct as you want - the parser complains about the typedef. * The last three lines of the error message are nonsense. Hopefully, this gets fixed with the new parser. Regards, Volker http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4707