public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23513] New: overload resolution fails to select a more specialized template
@ 2005-08-22  9:48 maxim dot yegorushkin at gmail dot com
  2005-08-22 11:17 ` [Bug c++/23513] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: maxim dot yegorushkin at gmail dot com @ 2005-08-22  9:48 UTC (permalink / raw)
  To: gcc-bugs

This well-formed complete source is rejected by g++, but compiles fine 
with comeau online 4.3.3 BETA August 4, 2003.
A related discussion on clc++ http://groups-beta.google.com/group/comp.
lang.c++/msg/1475f4e8f1ff9982

struct A
{
    template<class T> void operator<<(T&);
};

template<class T> struct B {};
template<class T> void operator<<(A&, B<T>&);

int main()
{
    A a;
    B<A> b;
    a << b;
}

[max@localhost exp]$ g++ -v -save-temps -Wall exp.cpp -o exp
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-
checking=release --with-system-zlib --enable-__cxa_atexit --disable-
libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,
objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/
java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)
 /usr/libexec/gcc/i386-redhat-linux/4.0.1/cc1plus -E -quiet -v -
D_GNU_SOURCE exp.cpp -Wall -fpch-preprocess -o exp.ii
ignoring nonexistent directory "/usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../
i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1
 /usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/i386-redhat-
linux
 /usr/lib/gcc/i386-redhat-linux/4.0.1/../../../../include/c++/4.0.1/backward
 /usr/local/include
 /usr/lib/gcc/i386-redhat-linux/4.0.1/include
 /usr/include
End of search list.
 /usr/libexec/gcc/i386-redhat-linux/4.0.1/cc1plus -fpreprocessed exp.ii -quiet 
-dumpbase exp.cpp -auxbase exp -Wall -version -o exp.s
GNU C++ version 4.0.1 20050727 (Red Hat 4.0.1-5) (i386-redhat-linux)
	compiled by GNU C version 4.0.1 20050727 (Red Hat 4.0.1-5).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-
heapsize=64417
exp.cpp: In function 'int main()':
exp.cpp:13: error: ambiguous overload for 'operator<<' in 'a << b'
exp.cpp:3: note: candidates are: void A::operator<<(T&) [with T = B<A>]
exp.cpp:7: note:                 void operator<<(A&, B<T>&) [with T = A]

# 1 "exp.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "exp.cpp"
struct A
{
    template<class T> void operator<<(T&);
};

template<class T> struct B {};
template<class T> void operator<<(A&, B<T>&);

int main()
{
    A a;
    B<A> b;
    a << b;
}

-- 
           Summary: overload resolution fails to select a more specialized
                    template
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: maxim dot yegorushkin at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23513


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <bug-23513-10484@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2005-10-05 11:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-22  9:48 [Bug c++/23513] New: overload resolution fails to select a more specialized template maxim dot yegorushkin at gmail dot com
2005-08-22 11:17 ` [Bug c++/23513] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-08-26 15:02 ` pinskia at gcc dot gnu dot org
2005-08-27 21:51 ` mmitchel at gcc dot gnu dot org
2005-09-15 21:19 ` mmitchel at gcc dot gnu dot org
2005-09-16  7:30 ` nathan at gcc dot gnu dot org
2005-09-16 13:37 ` nathan at gcc dot gnu dot org
2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-23513-10484@http.gcc.gnu.org/bugzilla/>
2005-10-05  9:15 ` cvs-commit at gcc dot gnu dot org
2005-10-05 11:07 ` nathan at gcc dot gnu dot org
2005-10-05 11:07 ` cvs-commit 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).