Bug 49630

Summary: g++ uses namespace std by default
Product: [Retired] Red Hat Linux Reporter: Wagner T. Correa <wtcorrea>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-07-22 11:58:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wagner T. Correa 2001-07-21 23:22:26 UTC
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
namespace std'.

How reproducible:
Always

Steps to Reproduce:
Compile the following with 'g++ -Wall -c':
#include <vector>
vector<int> v;


Actual Results:  The code compiles with no errors or warnings.

Expected Results:  g++ should have generated an error.

Additional info:

Comment 1 Michael Schwendt 2001-07-22 11:58:29 UTC
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.

Comment 2 Jakub Jelinek 2001-07-22 18:38:00 UTC
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.