Bug 16605 - expected unqualified-id before '(' token in vector.tcc and stl_bvector.h
Summary: expected unqualified-id before '(' token in vector.tcc and stl_bvector.h
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
: 27217 (view as bug list)
Depends on:
Reported: 2004-07-17 11:03 UTC by Gerhard Strangar
Modified: 2006-04-19 18:24 UTC (History)
2 users (show)

See Also:
Host: i386-pc-solaris2.9
Target: i386-pc-solaris2.9
Build: 3.4.1
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Strangar 2004-07-17 11:04:00 UTC
There seems to be a bug in the STL code. When I compile RealVNC 4.0, I get error
messages like this one:

error: expected unqualified-id before '(' token

I also get these messages for bits/vector.tcc. Taking a look at the files showed
that the code uses "std::max" instead of "max". After removing the "std::", the
compilation completes without errors.
Comment 1 Falk Hueffner 2004-07-17 11:55:03 UTC
Please provide a test case (ideally both preprocessed and unpreprocessed)
and *complete* error messages.
Comment 2 Andrew Pinski 2004-07-17 17:36:35 UTC
I think the issue comes form you (or really the source) define max to be something which is wrong 
because you violate the C++ standard as there is a max in std also.
Comment 3 Gerhard Strangar 2004-07-17 17:49:39 UTC
The complete error message is:

c++   -I.. -DHAVE_VSNPRINTF -O2 -Wall -Wno-unknown-pragmas -Wno-implicit-int
-fpermissive -c HTTPServer.cxx
cc1plus: warning: command line option "-Wno-implicit-int" is valid for C/ObjC
but not for C++
In file included from
                 from ../rfb/Region.h:25,
                 from ../rfb/UpdateTracker.h:23,
                 from ../rfb/HTTPServer.h:32,
                 from HTTPServer.cxx:19:
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&)':
error: expected unqualified-id before '(' token
*** Error code 1
make: Fatal error: Command failed for target `HTTPServer.o'
Current working directory /disk3/vnc-4.0-unixsrc/rfb
*** Error code 1
make: Fatal error: Command failed for target `all'

I don't know how to make a test case, I didn't even write the code which fails
to compile. But I took a look at vector.tcc of gcc 3.3.2 and saw the missing
"std::" in front of "max" and removed it from vector.tcc auf gcc 3.4.1 and then
VNC compiled without any errors.
Comment 4 Andrew Pinski 2004-07-17 17:51:24 UTC
Actually this is not a gcc bug but rather a bug in the sources you trying to compile, report it to them 
instead of us.
Comment 5 Wolfgang Bangerth 2004-07-19 13:38:56 UTC
Your code defines min/max as macros. The preprocessor expands this, which 
leaves what used to be std::max(x1, x2) as something that doesn't make 
much sense to the compiler any more. 
Since the standard says that the names min/max are reserved, simply 
remove these #defines from your sources. 
Comment 6 Paolo Carlini 2006-04-19 18:24:46 UTC
*** Bug 27217 has been marked as a duplicate of this bug. ***