This is the mail archive of the gcc@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]

Voice your opinion! (overload resolution)



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 =
====================================================



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