This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12536] Regression regarding partial ordering


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]