Topic: overload resolution question
Author: bkline@cortex.nlm.nih.gov (Bob Kline)
Date: 1995/11/18 Raw View
We notice that the ARM has the following language:
"Since for any type T, a T and a T& accept the same set of initializer
values, functions with argument types differing only in this respect
may not have the same. .... Similarly, since for any type T, a T, a
const T, and a volatile T accept the same set of initializer values,
functions with argument types differing only in this respect may not
have the same name."
However, we are unable to find the equivalent language in the latest
draft. Is this intentional? Is the following call of f() ambiguous?
void f(const A&);
void f(const A);
....
A a;
f(a);
We get different results from different compilers. One rejects the
call as ambiguous, and the other resolves the call to the second
version. Is the answer any different if the second version of
f() is declared 'void f(A);' (without const in front of A)?
--
/*----------------------------------------------------------------------*/
/* Bob Kline Stream International */
/* bob_kline@stream.com formerly Corporate Software, Inc. */
/* voice: (703) 522-0820 x-311 fax: (703) 522-5407 */
/*----------------------------------------------------------------------*/
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]