Topic: inconsistance in over.over
Author: jsa@edg.com (J. Stephen Adamczyk)
Date: 1996/02/01 Raw View
In article <4eo2mk$7tc@boy.nmd.msu.ru> krotoff@such.srcc.msu.su (Alexander Krotoff) writes:
>There is small inconsistance in the Oct 95 WP:
>-----------------------------------------------------------------------
>13.4 Address of overloaded function [over.over]
>In the example on the end of the section:
>
> int (X::*p5)(int) = &(X::f); // error: wrong syntax for</B>
> // pointer to member</B>
> int (*p6)(long) = &(X::f); // OK</B>1
>
>Error: qualified-id enclosed in parentheses.
>-----------------------------------------------------------------------
>5.3.1 Unary operators [expr.unary.op]
>
>3 A pointer to member is only formed when an explicit & is used and
> its operand is a qualified-id not enclosed in parentheses.
>-----------------------------------------------------------------------
>
>I suppose the error is in the over.over.
Why do you think there's an error? The point of the example in over.over
is that something like X::f can represent a set of overloaded functions,
some of which are nonstatic member functions and some of which are static
member functions. That set is subjected to overload resolution, and one
of the functions is chosen. If the one chosen is a nonstatic member function,
then the form used must be &X::f. But if the one chosen is a static
member function, the form can be X::f or &X::f or &(X::f) etc., because
any of those is a valid form for the address of a static member function.
Steve Adamczyk
Edison Design Group
---
[ 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. ]
Author: krotoff@such.srcc.msu.su (Alexander Krotoff)
Date: 1996/02/06 Raw View
vandevod@cs.rpi.edu (David Vandevoorde) wrote:
> I fail to see the problem. 5.3.1 (which you quote correctly) says that
> &X::f could be a pointer to member, but not &(X::f); so that explains
> the error in 13.4. &(X::f) resolves to the pointer to a static member
> function (which is a pointer to a regular function) in that same
> example, so that's fine. Note that the target type resolves the overload.
Sorry, it was my misstake.
-ank
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is
in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Author: krotoff@such.srcc.msu.su (Alexander Krotoff)
Date: 1996/02/01 Raw View
Hello c++ gurus,
There is small inconsistance in the Oct 95 WP:
-----------------------------------------------------------------------
13.4 Address of overloaded function [over.over]
In the example on the end of the section:
int (X::*p5)(int) = &(X::f); // error: wrong syntax for</B>
// pointer to member</B>
int (*p6)(long) = &(X::f); // OK</B>1
Error: qualified-id enclosed in parentheses.
-----------------------------------------------------------------------
5.3.1 Unary operators [expr.unary.op]
3 A pointer to member is only formed when an explicit & is used and
its operand is a qualified-id not enclosed in parentheses.
-----------------------------------------------------------------------
I suppose the error is in the over.over.
--
Alexander N. Krotoff krotoff@such.srcc.msu.su
Research Computer Center tel: +7(095)939-2638
Moscow State University fax: +7(095)939-4430
---
[ 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. ]
Author: vandevod@cs.rpi.edu (David Vandevoorde)
Date: 1996/02/01 Raw View
>>>>> "AK" == Alexander Krotoff <krotoff@such.srcc.msu.su> writes:
[...]
AK> There is small inconsistance in the Oct 95 WP:
AK> -----------------------------------------------------------------------
AK> 13.4 Address of overloaded function [over.over]
AK> In the example on the end of the section:
AK> int (X::*p5)(int) = &(X::f); // error: wrong syntax for</B>
AK> // pointer to member</B>
AK> int (*p6)(long) = &(X::f); // OK</B>1
AK> Error: qualified-id enclosed in parentheses.
AK> -----------------------------------------------------------------------
AK> 5.3.1 Unary operators [expr.unary.op]
AK> 3 A pointer to member is only formed when an explicit & is used and
AK> its operand is a qualified-id not enclosed in parentheses.
AK> -----------------------------------------------------------------------
AK> I suppose the error is in the over.over.
I fail to see the problem. 5.3.1 (which you quote correctly) says that
&X::f could be a pointer to member, but not &(X::f); so that explains
the error in 13.4. &(X::f) resolves to the pointer to a static member
function (which is a pointer to a regular function) in that same
example, so that's fine. Note that the target type resolves the overload.
Daveed
---
[ 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. ]