This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12536] Regression regarding partial ordering
- From: "jhr dot walter at t-online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Oct 2003 08:26:40 -0000
- Subject: [Bug c++/12536] Regression regarding partial ordering
- References: <20031008065459.12536.jhr.walter@t-online.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12536
------- Additional Comments From jhr dot walter at t-online dot de 2003-10-15 08:26 -------
Due to Graeme's and Patrick's explanations I see the following reasoning to
believe that the newer GCCs are wrong:
1. Overloaded foo()
(i) template<typename A>
some_type<A> foo(A const& a)
(ii) template<typename R, typename A>
some_type<R> foo(A const& a)
For (i) synthesize unique type U for template parameter A.
Call the function (ii) with U const& u: foo(u)
For (ii) A is deduced to U and deduction of R fails.
(i) can't call (ii)
For (ii) synthesize unique types U1, U2 for template parameters R, A.
Call the function (i) with U2 const& u2: foo(u2)
For (i) A is deduced to U2.
(ii) can call (i)
(ii) is more specialized than (i)
2. Overloaded bar()
(i) template<typename A>
some_type<A> bar(A const& a, A const& = A())
(ii) template<typename R, typename A>
some_type<R> bar(A const& a, R const& = R())
For (i) synthesize unique type U for template parameter A.
Call the function (ii) with U const& u1, U const& u2: bar(u1, u2)
For (ii) A is deduced to U and R is deduced to U.
(i) can call (ii)
For (ii) synthesize unique types U1, U2 for template parameters R, A.
Call the function (i) with U1 const& u1, U2 const& u2: bar(u2, u1)
For (i) deduction of A fails (it could be U1 or U2).
(ii) can't call (i)
(i) is more specialized.than (ii).
Newer GCCs believe (ii) is more specialized than (i).