This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Voice your opinion! (overload resolution)
- To: egcs at cygnus dot com
- Subject: Voice your opinion! (overload resolution)
- From: "Reid M. Pinchback" <reidmp at mit dot edu>
- Date: Wed, 02 Sep 1998 15:11:36 -0400
I'm trying to figure out if part of the overload resolution
behaviour of the 19980824 is or isn't a bug w.r.t. CD2,
but I'm still not sure. The relevant sections appear to be:
* all of 13 [over]/13-1
* 14.6.4.3 [temp.dep.conv]/14-26
* 14.8.3 [temp.over]/14-41
Here's the deal. Case 3 below results in the error:
no matching function for call to 'f (int, B)'
while the first two cases below yield a match. The same
behaviour is seen if a binary operator is used in place
of a function. Should case 3 fail, or the user-defiend
conversion in the templated class by used (presumably
by the implicit instantiation A<int>) ?
#define CASE4
#if defined(CASE1)
struct A {int x; A(int v):x(v){} };
struct B {int x; B(int v):x(v){} };
int f(A a, B b) { return a.x+b.x; }
#elif defined(CASE2)
template <class T> struct A {T x; A(T v):x(v){} };
struct B {int x; B(int v):x(v){} };
int f(A<int> a, B b) { return a.x+b.x; }
#elif defined(CASE3)
template <class T> struct A {T x; A(T v):x(v){} };
struct B{int x; B(int v):x(v){} };
template <class T> int f(A<T> a, B b) { return a.x+b.x; }
#endif
main (int argc, char*argv[]) {
int c=f(1,B(1));
}
====================================================
= Reid M. Pinchback =
= I/T Delivery, MIT =
= =
= Email: reidmp@mit.edu =
= URL: http://web.mit.edu/reidmp/www/home.html =
====================================================