From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 708 invoked by alias); 1 Dec 2001 19:46:01 -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 672 invoked by uid 71); 1 Dec 2001 19:46:00 -0000 Resent-Date: 1 Dec 2001 19:46:00 -0000 Resent-Message-ID: <20011201194600.671.qmail@sourceware.cygnus.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, =?iso-8859-1?Q?Alexander_B=FCrger?= Received:(qmail 31967 invoked from network); 1 Dec 2001 19:40:46 -0000 Received: from unknown (HELO feynman) (131.220.116.29) by hostedprojects.ges.redhat.com with SMTP; 1 Dec 2001 19:40:46 -0000 Received: from ab by feynman with local (Exim 3.33 #1 (Debian)) id 16AG06-0001Ra-00; Sat, 01 Dec 2001 20:40:38 +0100 Message-Id: Date: Sat, 01 Dec 2001 11:46:00 -0000 From: =?iso-8859-1?Q?Alexander_B=FCrger?= To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org X-Send-Pr-Version:3.113 Subject: c++/4980: -pedantic leads to parse error at strange place X-SW-Source: 2001-12/txt/msg00041.txt.bz2 List-Id: >Number: 4980 >Category: c++ >Synopsis: -pedantic leads to parse error at strange place >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Sat Dec 01 11:46:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Alexander Buerger >Release: 3.0.2 (Debian) (Debian testing/unstable) >Organization: >Environment: System: Linux feynman 2.4.16 #1 Fre Nov 30 13:25:13 CET 2001 i586 unknown Architecture: i586 host: i386-pc-linux-gnu build: i386-pc-linux-gnu target: i386-pc-linux-gnu configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux >Description: G++ fails to parse the first line in the `delete_elements' method (below), but only with `-pedantic' switched on. >How-To-Repeat: Compilation of the following source ------------------ #include template void delete_elements( std::vector< C* >& vec ) { std::vector< C* >::iterator it=vec.begin(); // FIXME: -pedantic does not like this; why??? while( it!=vec.end() ) delete *it++; } int main( int, char*[] ) { std::vector v; delete_elements( v ); return 0; } ------------------ with `gcc-3.0 -v -pedantic -o test test.cpp' leads to this output (on my machine): ------------------ Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.2/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux Thread model: posix gcc version 3.0.2 (Debian) /usr/lib/gcc-lib/i386-linux/3.0.2/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=2 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -pedantic -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ test.cpp -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase test.cpp -pedantic -version -o /tmp/cc27ERkQ.s GNU CPP version 3.0.2 (Debian) (cpplib) (i386 Linux/ELF) GNU C++ version 3.0.2 (Debian) (i386-linux) compiled by GNU C version 3.0.2 (Debian). ignoring nonexistent directory "/usr/i386-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/include/g++-v3 /usr/include/g++-v3/i386-linux /usr/include/g++-v3/backward /usr/local/include /usr/lib/gcc-lib/i386-linux/3.0.2/include /usr/include End of search list. test.cpp: In function `void delete_elements(std::vector >&)': test.cpp:112: parse error before `=' token test.cpp: In function `void delete_elements(std::vector >&) [with C = int]': test.cpp:120: instantiated from here test.cpp:113: `it' undeclared (first use this function) test.cpp:113: (Each undeclared identifier is reported only once for each function it appears in.) ------------------ The problem does not appear without `-pedantic'. >Fix: Work-around: omit `-pedantic'. >Release-Note: >Audit-Trail: >Unformatted: