public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Alexander Bürger" <acfb@gmx.de> To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org Subject: c++/4980: -pedantic leads to parse error at strange place<synopsis of the problem (one line)> Date: Sat, 01 Dec 2001 11:46:00 -0000 [thread overview] Message-ID: <E16AG06-0001Ra-00@feynman> (raw) >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 <vector> template<typename C> 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<int*> 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<C*, std::allocator<C*> >&)': test.cpp:112: parse error before `=' token test.cpp: In function `void delete_elements(std::vector<C*, std::allocator<C*> >&) [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:
reply other threads:[~2001-12-01 19:46 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=E16AG06-0001Ra-00@feynman \ --to=acfb@gmx.de \ --cc=debian-gcc@lists.debian.org \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).