public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/2957: -pedantic: parse error
@ 2001-05-28 3:46 Artem Khodush
0 siblings, 0 replies; 3+ messages in thread
From: Artem Khodush @ 2001-05-28 3:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/2957; it has been noted by GNATS.
From: "Artem Khodush" <artem@duma.gov.ru>
To: <gcc-gnats@gcc.gnu.org>
Cc: <87000-quiet@bugs.debian.org>, <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/2957: -pedantic: parse error
Date: Mon, 28 May 2001 14:30:49 +0400
Matthias Klose wrote:
>
> example below compiled witch -pedantic makes:
>
> $ g++-3.0 -pedantic foo.cc
> foo.cc: In function `int foo()':
> foo.cc:8: parse error before `;' token
>
> w/o -pedantic it is ok.
>
>
> #include <vector>
>
> using namespace std;
>
> template<class T>
> int foo()
> {
> vector<T>::iterator i; /* this line: parse error before ';' */
> }
standard-conforming code must use typename here:
typename vector<T>::iterator i;
but gcc detects this only in pedantic mode.
(the compiler does not know that vector<T>::iterator is always a type
for an arbitrary value of T, hence the parse error).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/2957: -pedantic: parse error
@ 2001-05-27 2:16 Gabriel Dos Reis
0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Dos Reis @ 2001-05-27 2:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/2957; it has been noted by GNATS.
From: Gabriel Dos Reis <gdr@codesourcery.com>
To: 87000-quiet@bugs.debian.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/2957: -pedantic: parse error
Date: 27 May 2001 11:14:04 +0200
Matthias Klose <doko@cs.tu-berlin.de> writes:
| #include <vector>
|
| using namespace std;
|
| template<class T>
| int foo()
| {
| vector<T>::iterator i; /* this line: parse error before ';' */
That is correct behaviour. vector<T>::iterator is a dependent name. So
by default it is not parsed as a type-name. To convince the compiler
to take it as a type, then you need to say
typename vector<T>::itertor i;
^^^^^^^^
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/2957: -pedantic: parse error
@ 2001-05-26 11:16 Matthias Klose
0 siblings, 0 replies; 3+ messages in thread
From: Matthias Klose @ 2001-05-26 11:16 UTC (permalink / raw)
To: gcc-gnats; +Cc: 87000-quiet
>Number: 2957
>Category: c++
>Synopsis: -pedantic: parse error
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 26 11:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Debian BTS #87000
>Release: 3.0 20010526 (Debian prerelease) (Debian testing/unstable)
>Organization:
Debian
>Environment:
System: Linux smile 2.2.17 #1 Sun Oct 8 19:26:41 MEST 2000 i686 unknown
Architecture: i686
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-x --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
example below compiled witch -pedantic makes:
$ g++-3.0 -pedantic foo.cc
foo.cc: In function `int foo()':
foo.cc:8: parse error before `;' token
w/o -pedantic it is ok.
#include <vector>
using namespace std;
template<class T>
int foo()
{
vector<T>::iterator i; /* this line: parse error before ';' */
}
int main(){return 0;}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-05-28 3:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-28 3:46 c++/2957: -pedantic: parse error Artem Khodush
-- strict thread matches above, loose matches on Subject: below --
2001-05-27 2:16 Gabriel Dos Reis
2001-05-26 11:16 Matthias Klose
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).