Red Hat Bugzilla – Bug 49630
g++ uses namespace std by default
Last modified: 2007-04-18 12:34:59 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.3-12 i686)
Description of problem:
If you want to use an STL class, let's say std::vector, g++ does not
require you to write std::vector, even if you don't specify 'using
Steps to Reproduce:
Compile the following with 'g++ -Wall -c':
Actual Results: The code compiles with no errors or warnings.
Expected Results: g++ should have generated an error.
FWIW, this is not due to g++ but due to the included libstdc++ not being
entirely standards compliant. It is not libstdc++ v3 yet which will fix this
(hopefully). If you roll your own namespaces, those work.
g++-2.96-RH, like all g++ compilers before it, default to
-fno-honor-std, ie. std namespace is treated specially.
This is because of libstdc++-v2 which is not namespace clean etc.
Grab g++3-3.0* rpms from rawhide if you're looking for a C++
compiler which will give you error for the above.