When compiling the following code, an incorrect binary is produced: --- BEGIN CODE --- namespace test { double f(double f) { return f + 1.; } }
double f(float d) { return d; } int main(int argc, char *argv[]) { using test::f; float d = 2.; double result1 = f(d); double result2 = test::f(d); return 0; } --- END CODE --- The line double result1 = f(d); should call the function "double f(float d)", instead it calls the function "double f(double f)" in namespace test. This breaks argument dependent lookup. The using directive should only make visible the function in namespace test, but not hide the global one. If you replace "using test::f" with "using namespace test", then everything works correctly. gcc -v gives me: ~> gcc -v Using built-in specs. Target: x86_64-suse-linux Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,f95,java,ada --disable-checking --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk --disable-libjava-multilib --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit --without-system-libunwind --host=x86_64-suse-linux Thread model: posix gcc version 4.0.2 20050901 (prerelease) (SUSE Linux) -- Summary: using directive breaks ADL Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dg001 at t-online dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26110