Movatterモバイル変換


[0]ホーム

URL:


Issue 2381 - WG21 CWG Issues
Title
Composite pointer type of pointers to plain and noexcept member functions
Status
cd5
Section
7.2.2 [expr.type]
Submitter
Mike Miller

Created on2018-06-19.00:00:00 last changed62 months ago

Messages

msg6372 (view)
Date: 2019-02-15.00:00:00

Proposed resolution (February, 2019):

  1. Change 7.2.2 [expr.type] paragraph 4 as follows:

  2. Thecomposite pointer type of twooperandsp1 andp2 havingtypesT1 andT2, respectively, where atleast one is a pointer or pointer-to-member typeorstd::nullptr_t, is:

    • ...

    • ifT1 orT2 is “pointerto member ofC1 of type function”, the othertype is “pointer to member ofC2 of typenoexcept function”, andC1 isreference-related toC2 orC2 isreference-related toC1 (9.5.4 [dcl.init.ref]),where the function types are otherwise the same, “pointerto member ofC2 of type function” or“pointer to member ofC1 of type function”,respectively;

    • ifT1 is “pointer to memberofC1 of typecv1U1U”andT2 is “pointer to member ofC2of typecv2U2U, for some non-functiontypeU, whereC1 isreference-related toC2 orC2 isreference-related toC1(9.5.4 [dcl.init.ref]), the cv-combined typeofT2 andT1 or the cv-combined typeofT1 andT2, respectively;

  3. Change 7.6.10 [expr.eq] paragraph 4 as follows:

  4. If at least one of the operands is a pointer to member,pointer-to-member conversions (7.3.13 [conv.mem]),function pointer conversions (7.3.14 [conv.fctptr]),and qualification conversions (7.3.6 [conv.qual])are performed on both operands to bring them to theircomposite pointer type (7.2 [expr.prop]).Comparing...
  5. Change 7.6.16 [expr.cond] bullet 7.4 as follows:

  6. Lvalue-to-rvalue (7.3.2 [conv.lval]),array-to-pointer (7.3.3 [conv.array]), andfunction-to-pointer (7.3.4 [conv.func]) standardconversions are performed on the second and thirdoperands. After those conversions, one of the followingshall hold:

    • ...

    • One or both of the second and third operands havepointer-to-member type; pointer to member conversions(7.3.13 [conv.mem]), function pointerconversions (7.3.14 [conv.fctptr]), andqualification conversions (7.3.6 [conv.qual]) areperformed to bring them to their composite pointer type(7.2 [expr.prop]). The result is of the compositepointer type.

    • ...

msg6371 (view)
Date: 2019-02-15.00:00:00

[Accepted as a DR at the February, 2019 meeting.]

According to 7.3.14 [conv.fctptr] paragraph 1,

A prvalue of type “pointer to member of typenoexceptfunction” can be converted to a prvalue of type“pointer to member of type function”. The resultdesignates the member function.

However, 7.2.2 [expr.type] paragraph 4 does notallow for this conversion in determining the compositepointer type of two pointers to member functions. Thecorresponding conversion is considered for pointers tonon-member functions, but only qualification conversions areconsidered for pointers to members:

Thecomposite pointer type of twooperandsp1 andp2 havingtypesT1 andT2, respectively, where atleast one is a pointer or pointer-to-member typeorstd::nullptr_t, is:

  • ...

  • ifT1 orT2 is “pointer tonoexcept function” and the other type is“pointer to function”, where the function typesare otherwise the same, “pointer tofunction”;

  • ...

  • ifT1 is “pointer to member ofC1of typecv1U1” andT2is “pointer to member ofC2 of typecv2U2” whereC1 is reference-relatedtoC2 orC2 is reference-relatedtoC1 (9.5.4 [dcl.init.ref]), the cv-combinedtype ofT2 andT1 or the cv-combined typeofT1 andT2, respectively;

Note also that the places that refer to “compositepointer type” only refer to 7.3.13 [conv.mem]for conversions involving pointers to members, omitting anyreference to 7.3.14 [conv.fctptr] for pointers tomember functions. This affects 7.6.9 [expr.rel],7.6.10 [expr.eq], and 7.6.16 [expr.cond].

History
DateUserActionArgs
2020-12-15 00:00:00adminsetmessages: +msg6372
2018-06-19 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp