cplusplus / cplusplus/draft

Mislead utterance of section [expr.mptr.oper]

Open
#4,703 6 comments 0 reactions 1 assignee View on GitHub

@jensmaurer is already working on this.

Since Jul 4, 2021.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

The binary operator .* binds its second operand, which shall be of type “pointer to member of T” to its first operand, which shall be a glvalue of class T or of a class of which T is an unambiguous and accessible base class. The result is an object or a function of the type specified by the second operand.

As aforementioned, the second operand has the type of “pointer to member of T”, but the rule says the result is an object or a function of the type specified by the second operand, Is it a contradiction here?

Maybe we should say

The result is an object or a function of the type specified by the entity to which the second operand refers.

Can E2 be the second operand of the class member access operator?

Abbreviating pm-expression.*cast-expression as E1.*E2, E1 is called the object expression. If the dynamic type of E1 does not contain the member to which E2 refers, the behavior is undefined. Otherwise, the expression E1 is sequenced before the expression E2.

The restrictions on cv-qualification, and the manner in which the cv-qualifiers of the operands are combined to produce the cv-qualifiers of the result, are the same as the rules for E1.E2 given in [expr.ref].

Again, E2 still has the type of “pointer to member of T” in the context of the above rule, which means E2 is invalid to be the second operand of the expression E1.E2.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.