Bug 138680 - g++ does'nt compile with <vector> template
Summary: g++ does'nt compile with <vector> template
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc34   
(Show other bugs)
Version: 3
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-11-10 17:49 UTC by yair
Modified: 2007-11-30 22:10 UTC (History)
0 users

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


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

Description yair 2004-11-10 17:49:20 UTC
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 22:45:47 UTC
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 23:53:24 UTC
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 23:55:27 UTC
Please rerun the above command with -E -dD instead of -c and attach here its output.

Comment 4 yair 2004-11-11 06:34:08 UTC
Created attachment 106476 [details]
output of g++ command with -E -dD parameters

Comment 5 Jakub Jelinek 2004-11-11 06:57:06 UTC
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.