public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9053: g++ confused about ambiguity of overloaded function templates
@ 2002-12-24 14:11 nathan
0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2002-12-24 14:11 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, martin, nathan
Synopsis: g++ confused about ambiguity of overloaded function templates
State-Changed-From-To: analyzed->closed
State-Changed-By: nathan
State-Changed-When: Tue Dec 24 14:11:07 2002
State-Changed-Why:
2002-12-24 Nathan Sidwell <nathan@codesourcery.com>
PR c++/9053
* decl.c (duplicate_decls): Templates may be disambiguated by
return type.
PR c++/8702
* decl2.c (check_classfn): Use lookup_fnfield_1. List all
conversion operators on failure.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9053
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/9053: g++ confused about ambiguity of overloaded function templates
@ 2002-12-24 11:25 nathan
0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2002-12-24 11:25 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, martin, nathan, nobody
Synopsis: g++ confused about ambiguity of overloaded function templates
Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-By: nathan
Responsible-Changed-When: Tue Dec 24 11:25:21 2002
Responsible-Changed-Why:
strange,I could've sworn I fixed this.
State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Tue Dec 24 11:25:21 2002
State-Changed-Why:
confirmed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9053
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/9053: g++ confused about ambiguity of overloaded function templates
@ 2002-12-24 10:36 martin
0 siblings, 0 replies; 3+ messages in thread
From: martin @ 2002-12-24 10:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 9053
>Category: c++
>Synopsis: g++ confused about ambiguity of overloaded function templates
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Dec 24 10:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Martin Buchholz
>Release: g++ 3.2.1
>Organization:
>Environment:
Linux x86
>Description:
g++ must consider whether return types
of function templates lead to substitution failure
before giving an ambiguity error. Considering only
arguments is insufficient.
These two function templates
template <class T> typename bar<T>::type foo (T);
template <class T> typename qux<T>::type foo (T);
look ambiguous, but may not be if, when instantiated
with a particular type, one of bar<T> or qux<T>
leads to substitution failure.
Easier to give an example than explain...
The code below compiles under icc and Comeau C++,
but not g++.
(Also: g++ gives ambiguity errors even if foo is never
instantiated, which is probably wrong.)
g++ gives:
ambiguous-template-bug2.cc:10: new declaration `template<class T> qux::type
foo(T)'
ambiguous-template-bug2.cc:7: ambiguates old declaration `template<class T>
bar::type foo(T)'
source code:
template <typename T> class bar;
template <> struct bar<const char*> { typedef void type; };
template <typename T> class qux;
template <> struct qux<int> { typedef void type; };
template <typename T>
typename bar<T>::type foo (T t) { }
template <typename T>
typename qux<T>::type foo (T t) { }
int
main (int argc, char *argv[])
{
foo ("foo");
foo (7);
}
>How-To-Repeat:
Compile source code with g++
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-12-24 22:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-24 14:11 c++/9053: g++ confused about ambiguity of overloaded function templates nathan
-- strict thread matches above, loose matches on Subject: below --
2002-12-24 11:25 nathan
2002-12-24 10:36 martin
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).