Topic: ovelroad resolution


Author: "pm" <pm@NOSPAM.net>
Date: 2000/04/01
Raw View
#include <iostream>

void f () {}
void g (void (*)()) { std::cout << " void (*)()" << std::endl; }
void g (void (&)()) { std::cout << " void (&)()" << std::endl; }

int main ()
  {
    g (f);
  }


my compiler (BCB4) selects the pointer-to-function version of f().

Is this the correct (defined) behavior ?


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Biju Thomas <b.thomas@attglobal.net>
Date: 2000/04/01
Raw View
pm wrote:
>
> #include <iostream>
>
> void f () {}
> void g (void (*)()) { std::cout << " void (*)()" << std::endl; }
> void g (void (&)()) { std::cout << " void (&)()" << std::endl; }
>
> int main ()
>   {
>     g (f);
>   }
>
> my compiler (BCB4) selects the pointer-to-function version of f().
>
> Is this the correct (defined) behavior ?
>

It should report an ambiguity error since both candidate functions 'g'
are equally viable.

--
Biju Thomas

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]