[over.match.funcs.general] p4 direct member vs. member for defining the type of implicit object parameter
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
[over.match.funcs.general] p2 says
a member function that does not have an explicit object parameter is considered to have an extra first parameter, called the implicit object parameter, which represents the object for which the member function has been called.
[over.match.funcs.general] p4 says
where X is the class of which the function is a member and cv is the cv-qualification on the member function declaration.
Consider this example:
struct A{
void show(){}
};
struct B:A{
};
B bobj;
bobj.show();
In this case, the object for which the member function show is called is bobj that is of type B. [class.derived.general] p2 says
Members of a base class are also members of the derived class.
That is, show is also a member of class B. So, whether the type of the implicit object parameter is considered to be A& or B&? The intent should be the former. [over.match.funcs.general] p4 might be changed to
where X is the class of which the function is a direct member
For conversion functions that are implicit object member functions, the function is considered to be a direct member of the class of the implied object argument for the purpose of defining the type of the implicit object parameter.
For non-conversion functions that are implicit object member functions nominated by a using-declaration in a derived class, the function is considered to be a direct member of the derived class for the purpose of defining the type of the implicit object parameter.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with [over.match.funcs.general] paragraphs 2 and 4, then compare the example with [class.derived.general] paragraph 2. Resolve whether the implicit object parameter uses A& or B& for inherited and using-declared member functions, and update the proposed standard wording so the intended direct-member rule is unambiguous.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100