This is the mail archive of the
mailing list for the GCC project.
Re: 'using namespace std' before including header
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Geoffrey Keating <gkeating at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 22 Oct 2006 17:51:10 -0700
- Subject: Re: 'using namespace std' before including header
- References: <20061018200840.C9F604D525C1@geoffk5.apple.com>
On Wed, 2006-10-18 at 13:08 -0700, Geoffrey Keating wrote:
> As far as I can tell from the C++ standard, there is no implicit
> predeclaration of the 'std' namespace. Thus, a file that contains
> using namespace std;
> requires an error, due to [basic.lookup.unqual] paragraph 1, "If no
> declaration is found, the program is ill-formed" or possibly
> [lib.using.headers], "A translation unit ... shall include the header
> lexically before the first reference to any of the entities it
> declares or first defines in that translation unit."
This problem is now recorded as PR 29556.