cplusplus / cplusplus/draft

[class.access.base] p6 Unclear about the cv-qualification

Open
#4,952 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

[class.access.base] p6

If a class member access operator, including an implicit “this->”, is used to access a non-static data member or non-static member function, the reference is ill-formed if the left operand (considered as a pointer in the “.” operator case) cannot be implicitly converted to a pointer to the naming class of the right operand.

struct A{
   int a = 0;
};
struct B: A{
};
const B b;
(&b)->A::a;

The naming class of the right operand is class B while the left operand is a pointer to const B, from a pointer to const B to a pointer to A discards the cv-qualification, hence the implicit conversion cannot be done. It is not the intent of this rule, however, it is not clear in this wording about whether considering the cv-qualification when we say implicit conversions.

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.

Research direction

Start with [class.access.base] paragraph 6 and the supplied inheritance example involving const B and A::a. Determine whether the wording should explicitly address cv-qualification in the implicit conversion rule; the issue is done when the standard text clearly expresses the intended treatment without ambiguity.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.