[c++] builtin functions and namespaces
Benjamin Kosnik
bkoz@redhat.com
Tue Sep 26 09:26:00 GMT 2000
Brent, we can go with just this slightly simplified example:
// start
namespace _C_ {
extern "C" {
extern int abs(int a);
}
}
namespace std {
using ::_C_::abs;
}
using namespace std;
int
main()
{
abs(1);
}
// end
%eccp --strict kill.cc
%g++ -c -fno-builtin kill.cc
%g++ -c kill.cc
kill.cc:8: `abs' is already declared in this scope
kill.cc: In function `int main ()':
kill.cc:16: `abs' undeclared (first use this function)
kill.cc:16: (Each undeclared identifier is reported only once for each
function it appears in.)
This appears to be a bug or limitation of g++. Jason, Martin, what are
the options for namespace-using libraries such as libstdc++-v3? Should
we default to not using builtins for the moment? It would be nice for
this to work in a similar manner with and without builtins.
-benjamin
More information about the Gcc-bugs
mailing list