From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19587 invoked by alias); 16 Dec 2006 13:15:38 -0000 Received: (qmail 19561 invoked by uid 48); 16 Dec 2006 13:15:27 -0000 Date: Sat, 16 Dec 2006 13:15:00 -0000 Subject: [Bug c++/30232] New: Templated function seems to hide non-templated one with same name under certain circumstances in newer versions of g++. X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "whisp at users dot sf dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-12/txt/msg01434.txt.bz2 Attached are to short example programs (no special includes and options needed). Both programs compile and run fine with g++-3.3.5, but fail to compile with g++-4.1.1 and g++-4.3.0. The problem seems to be that a function template inline void foo(SomeType &obj) prevents another function inline void foo(int &) from beeing found by the compiler under certain circumstances. gcc-tmplshadow-bug-1.cc is extremly short, gcc-tmplshadow-bug-2.cc shows the problem in a more detailed way and allows for some variation. $ g++-4.3 gcc-tmplshadow-bug-1.cc -o gcc-tmplshadow-bug-1 gcc-tmplshadow-bug-1.cc: In function ‘void foo(SomeType&) [with tp_type = int]’: gcc-tmplshadow-bug-1.cc:24: instantiated from here gcc-tmplshadow-bug-1.cc:13: error: no matching function for call to ‘foo(int&)’ $ g++-4.3 gcc-tmplshadow-bug-1.cc -o gcc-tmplshadow-bug-1 gcc-tmplshadow-bug-1.cc: In function ‘void foo(SomeType&) [with tp_type = int]’: gcc-tmplshadow-bug-1.cc:24: instantiated from here gcc-tmplshadow-bug-1.cc:13: error: no matching function for call to ‘foo(int&)’ oli@sl2:~/Data/Source/C/Local/Bugs> g++-4.3 gcc-tmplshadow-bug-2.cc -o gcc-tmplshadow-bug-2 gcc-tmplshadow-bug-2.cc: In function ‘void bar(tp_type&) [with tp_type = Type3]’: gcc-tmplshadow-bug-2.cc:51: instantiated from here gcc-tmplshadow-bug-2.cc:34: error: no matching function for call to ‘foo(int&)’ $ g++-4.3 -v Using built-in specs. Target: i686-suse-linux Configured with: ./configure --host=i686-suse-linux --build=i686-suse-linux --program-suffix=-4.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --enable-threads=posix --enable-languages=c,c++ --with-system-zlib --enable-shared --enable-nls --enable-__cxa_atexit --enable-checking=release Thread model: posix gcc version 4.3.0 20061209 (experimental) -- Summary: Templated function seems to hide non-templated one with same name under certain circumstances in newer versions of g++. Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: whisp at users dot sf dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30232