Bug 138680 - g++ does'nt compile with <vector> template
g++ does'nt compile with <vector> template
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gcc34 (Show other bugs)
3
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-10 12:49 EST by yair
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-11-11 01:57:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
output of g++ command with -E -dD parameters (246.51 KB, text/plain)
2004-11-11 01:34 EST, yair
no flags Details

  None (edit)
Description yair 2004-11-10 12:49:20 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041020
Firefox/0.10.1

Description of problem:
there appears to be errors in files: bits/stl_bvector.h
                                     bits/vector.tcc

i needed to replace all 'std::max' appearances to 'max'

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. compile a .cpp file that uses include <vector>
2.
3.
    

Additional info:
Comment 1 Jakub Jelinek 2004-11-10 17:45:47 EST
Please include small self-contained testcase which shows what problem do you see.
Compiling a .cpp file that includes <vector> certainly works for me (and there
are thousands of them already in the distribution itself).
Comment 2 yair 2004-11-10 18:53:24 EST
sorry, it does'nt happen on each .cpp

it happens when i try to compile "stage 1.3.4" from the "player/stage"
project
(playerstage.sourceforge.net)

this is the error:

g++ -DHAVE_CONFIG_H -I. -I. -I..  -Wall  -DXTHREADS -D_REENTRANT
-DXUSE_MTSAFE_API -I/usr/local/include -I/usr/include/gtk-2.0
-I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0
-I/usr/include/pango-1.0 -I/usr/include/freetype2
-I/usr/include/freetype2/config -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include     -g -O2 -c library.cc
In file included from
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/vector:72,
                 from models/bitmap.hh:18,
                 from library.cc:32:
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/stl_bvector.h:
In member function `void std::vector<bool,
_Alloc>::_M_insert_range(std::_Bit_iterator, _ForwardIterator,
_ForwardIterator,
std::forward_iterator_tag)':/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/stl_bvector.h:522:
error: expected unqualified-id before '(' token
In file included from
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/vector:75,
                 from models/bitmap.hh:18,
                 from library.cc:32:
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/vector.tcc:
In member function `void std::vector<_Tp,
_Alloc>::_M_fill_insert(__gnu_cxx::__normal_iterator<typename
_Alloc::pointer, std::vector<_Tp, _Alloc> >, size_t, const _Tp&)':
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/vector.tcc:307:
error: expected unqualified-id before '(' token
Comment 3 Jakub Jelinek 2004-11-10 18:55:27 EST
Please rerun the above command with -E -dD instead of -c and attach here its output.
Comment 4 yair 2004-11-11 01:34:08 EST
Created attachment 106476 [details]
output of g++ command with -E -dD parameters
Comment 5 Jakub Jelinek 2004-11-11 01:57:06 EST
It is a bug in the code you are compiling.
/usr/local/include/playercommon.h has:
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
and the .cc file in question first includes <map>, then defines these macros
and then includes <vector>.
You can't do this in C++, max is <vector> and other header's reserved identifier.

Note You need to log in before you can comment on or make changes to this bug.