This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/51749] New: Including <algorithm> pollute global namespace
- From: "nospam.kotarou.dono at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 04 Jan 2012 09:51:46 +0000
- Subject: [Bug libstdc++/51749] New: Including <algorithm> pollute global namespace
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51749
Bug #: 51749
Summary: Including <algorithm> pollute global namespace
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: nospam.kotarou.dono@gmail.com
Created attachment 26235
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26235
Preprocessed file
Including the header file <algorithm> on Linux seems to pollute the global
namespace. I discovered this while attempting to put <sys/select.h> in a
namespace. A quick example is given below:
test.cpp:
#include <algorithm>
fd_set set; // Should not compile
int main() { return 0; }
Compiles with: g++ test.cpp -o test
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/kotarou3/usr/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../mingw/gcc-src/configure
--prefix=/home/kotarou3/work/gcc-build/../gcc
--with-gmp=/home/kotarou3/work/gcc-build/../mingw/gmp
--with-mpfr=/home/kotarou3/work/gcc-build/../mingw/mpfr
--with-mpc=/home/kotarou3/work/gcc-build/../mingw/mpc --enable-languages=c,c++
--disable-win32-registry --enable-checking=release --enable-shared
Thread model: posix
gcc version 4.7.0 20111231 (experimental) (GCC)