g++: Identifier-dependent namespace/using lookup bug
Jens Maurer
jmaurer@menuett.rhein-main.de
Thu Feb 17 03:08:00 GMT 2000
Hello,
I tried to compile the enclosed program with
gcc version 2.95.2 19991024 (release)
gcc version 2.96 20000214 (experimental)
on Linux kernel 2.2.13, glibc 2.1.2.
The error message was in both cases
using-decl.cc: In method `double A<int>::func1()':
using-decl.cc:35: instantiated from here
using-decl.cc:25: `log' undeclared (first use this function)
using-decl.cc:25: (Each undeclared identifier is reported only once
using-decl.cc:25: for each function it appears in.)
However, the exact same usage with sin() works without any trouble
whatsoever. Comment out "x.func1()" and it compiles.
Why does the compiler fail to find the symbol "log" in its symbol
table?
Jens Maurer
namespace N1
{
extern double sin (double __x);
extern double log (double __x);
}
namespace N2 {
using ::N1::sin;
using ::N1::log;
}
template<class T>
class A {
public:
double func2()
{
using N1::sin;
return sin(2.0);
}
double func1()
{
using N1::log;
return log(2.0);
}
};
int main()
{
A<int> x;
x.func2();
x.func1();
}
More information about the Gcc-bugs
mailing list