Thread View: comp.std.c++
4 messages
4 total messages
Started by Alexander Krotoff
Thu, 01 Feb 1996 01:53
inconsistance in over.over
Author: Alexander Krotoff
Date: Thu, 01 Feb 1996 01:53
Date: Thu, 01 Feb 1996 01:53
29 lines
1661 bytes
1661 bytes
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. ]
Re: inconsistance in over.over
Author: David Vandevoorde
Date: Thu, 01 Feb 1996 13:17
Date: Thu, 01 Feb 1996 13:17
32 lines
2108 bytes
2108 bytes
>>>>> "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. ]
Re: inconsistance in over.over
Author: J. Stephen Adamczyk
Date: Thu, 01 Feb 1996 17:22
Date: Thu, 01 Feb 1996 17:22
35 lines
2405 bytes
2405 bytes
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. ]
inconsistance in over.over
Author: Alexander Krotoff
Date: Tue, 06 Feb 1996 18:26
Date: Tue, 06 Feb 1996 18:26
14 lines
1432 bytes
1432 bytes
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. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads