This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30232] New: Templated function seems to hide non-templated one with same name under certain circumstances in newer versions of g++.
- From: "whisp at users dot sf dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Dec 2006 13:15:27 -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++.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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 <class tp_type> inline void foo(SomeType<tp_type> &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<tp_type>&) [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<tp_type>&) [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