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]

Re: koenig lookup in C++


> cc: gcc@gcc.gnu.org, jason@cygnus.com, mark@codesourcery.com
> Date: Wed, 16 Aug 2000 19:06:01 +0200
> From: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>

> But here I'm quite sure that it is the test case that is wrong:
> 
>   Your templated f2 function certainly cannot be associated with any g 
>   function as it takes 2 parameters whereas all g functions expect as a 
>   parameter a function with ONLY ONE argument.

Consider this testcase:

namespace N1 {
  struct A { };
  void g(void (*)(A, A)) {}
}

template <class T>
void f2(N1::A, T) {}

void g(void (*)(int)) {}

int main() {  
   g(f2); // Works?
}

t.cc: In function `int main ()':
t.cc:12: no matches converting function `f2' to type `void (*) (int)'
t.cc:7: candidates are: template <class T> void f2 (N1::A, T)

Should it work?

-- 
- Geoffrey Keating <geoffk@cygnus.com>

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