From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23887 invoked by alias); 5 Feb 2006 22:15:04 -0000 Received: (qmail 23795 invoked by uid 48); 5 Feb 2006 22:15:00 -0000 Date: Sun, 05 Feb 2006 22:15:00 -0000 Subject: [Bug c++/26110] New: using directive breaks ADL X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dg001 at t-online dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-02/txt/msg00433.txt.bz2 List-Id: 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