public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "whisp at users dot sf dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/30232]  New: Templated function seems to hide non-templated one with same name under certain circumstances in newer versions of g++.
Date: Sat, 16 Dec 2006 13:15:00 -0000	[thread overview]
Message-ID: <bug-30232-13769@http.gcc.gnu.org/bugzilla/> (raw)

[-- 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


             reply	other threads:[~2006-12-16 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-16 13:15 whisp at users dot sf dot net [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30232-13769@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).