public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30232]  New: Templated function seems to hide non-templated one with same name under certain circumstances in newer versions of g++.
@ 2006-12-16 13:15 whisp at users dot sf dot net
  2006-12-16 13:16 ` [Bug c++/30232] " whisp at users dot sf dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: whisp at users dot sf dot net @ 2006-12-16 13:15 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2567 bytes --]

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-16 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-16 13:15 [Bug c++/30232] New: Templated function seems to hide non-templated one with same name under certain circumstances in newer versions of g++ whisp at users dot sf dot net
2006-12-16 13:16 ` [Bug c++/30232] " whisp at users dot sf dot net
2006-12-16 13:17 ` whisp at users dot sf dot net
2006-12-16 18:34 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).