This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/7187: virtual keyword parser error in STL templates
- From: wls at wwco dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: Tue, 2 Jul 2002 15:33:02 -0400
- Subject: libstdc++/7187: virtual keyword parser error in STL templates
- Reply-to: wls at wwco dot com
>Number: 7187
>Category: libstdc++
>Synopsis: Parse error concerning virtual keyword in the STL template
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Jul 02 12:36:05 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Walt Stoneburner
>Release: 3.1
>Organization:
self
>Environment:
Slackware 8.0
System: Linux spiff 2.4.17 #2 Wed Jan 16 17:37:02 EST 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure
>Description:
Including and using the STL <fstream> used to work in 3.0.x.
GCC v3.1 now produces an error message, even if the file is
included and never called.
In file included from /usr/local/include/g++-v3/fstream:48,
from t.cc:1:
/usr/local/include/g++-v3/bits/basic_file.h:52: parse error before `{' token
/usr/local/include/g++-v3/bits/basic_file.h:57: virtual outside class
declaration
...technically, the STL has this inside of a struct, but even if
you change the STL to read class, it does not work.
>How-To-Repeat:
1. Make a C++ file with just the include header. No code will
call it.
wls@spiff:/tmp$ cat /tmp/t.cc
#include <fstream>
wls@spiff:/tmp$ g++ -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../configure
Thread model: single
gcc version 3.1
2. Compile the file ... which should fail at the link stage.
We don't get that far.
wls@spiff:/tmp$ g++ /tmp/t.cc
In file included from /usr/local/include/g++-v3/fstream:48,
from /tmp/t.cc:1:
/usr/local/include/g++-v3/bits/basic_file.h:52: parse error before `{' token
/usr/local/include/g++-v3/bits/basic_file.h:57: virtual outside class
declaration
/usr/local/include/g++-v3/bits/basic_file.h:57: function `int std::overflow(int
= -1)' is initialized like a variable
hen reporting a compiler error, preprocessor output must be included>
>Fix:
Not using <fstream> causes the error to go away in my projects,
however, I'm then left without a file streaming mechanism.
>Release-Note:
>Audit-Trail:
>Unformatted: