This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix extern "C" function and namespace handling
- To: brent at rcfile dot org
- Subject: Re: [C++ PATCH] Fix extern "C" function and namespace handling
- From: Kriang Lerdsuwanakij <lerdsuwa at scf dot usc dot edu>
- Date: Sat, 7 Oct 2000 00:14:12 -0700 (PDT)
- cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
On Sat, 7 Oct 2000 brent@rcfile.org wrote:
> On 07 Oct 2000 at 01:25 (-0400), brent@rcfile.org wrote:
>
> well, mostly :)
> The following does not compile -- it should.
>
> namespace _C_ {
> extern "C" int abs(int a);
> }
> using ::_C_::abs;
>
> int main()
> {
> return 0;
> }
>
> dust$ Compile n.cc
> g++ -g -Wall -I. -DDEBUG_ASSERT n.cc -o n
> n.cc:4: `abs' is already declared in this scope
It's just that the abs builtin function was silently declare
in the global scope. So the using declaration catches this
error. Builtin functions can be moved to their own namespace
now as namespace doen't matter for C linkage functions anymore.
I haven't looked at the relevant codes in gcc to decide which
part should be modified yet. It should be sorted out in a few
days.
--Kriang