Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[namespace.udecl] Demote normative duplication to notes #1976

Merged
merged 2 commits into from Jul 6, 2018

Conversation

jensmaurer
Copy link
Member

The effects of using-declarations naming member functions
are discussed in other parts of the standard.
The effects of initializing with an inherited constructor are
discussed elsewhere, too.

Fixes #1975.

@tkoeppe tkoeppe added the after-motions Pull request is to be applied after the pending edits from WG21 straw polls have been applied. label Mar 31, 2018
This has no effect on the type of the function, and in all other
respects the function remains a member of the base class.
Likewise, constructors that are introduced by a \grammarterm{using-declaration}
A member of a derived class is sometimes preferred to a member of a base class
if they would otherwise be ambiguous\iref{over.match.best}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually only applies to the constructor case, right? (That is, what's now the next paragraph.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. With using-declarations and multiple inheritance etc., maybe member name lookup can yield a lookup set that contains both members of a derived class and of a base class (if name lookup could find the members of the base class via some other path). In that case, that note would also apply in that overload resolution gets to choose a unique result.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above "In particular, the implicit object parameter is treated as if it were a reference to the derived class" suggests that we don't take derived-to-base conversions on the implied object parameter into account. And actually, I'm not seeing anywhere in [over.match.funcs] that makes this clear; we are just told "X is the class of which the function is a member". So I think that part here is not duplicating other normative wording either.

So I'm not sure there's really all that much normative duplication here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zygoloid, we have in p4 in [over.match.funcs] "For non-conversion functions introduced by a using-declaration into a derived class, the function is considered to be a member of the derived class for the purpose of defining the type of the implicit object parameter." What's missing in that sentence that would be added by a normative "In particular ..." sentence?

@zygoloid
Copy link
Member

zygoloid commented Apr 1, 2018

The mix of normative and non-normative rules here is really strange (your changes here bring that pre-existing strangeness into focus). I think I'd like it more if we added a normative rule to [over.match.funcs] for the inherited constructor case (copying the rule from here) and turned everything in this section into a note.

@jensmaurer
Copy link
Member Author

@zygoloid: If we want to do this properly, we'd need a half-sentence (or so) in each of the three 16.3.1.x subclauses where constructors are enumerated, also in [class.qual] (we could have a using-declaration pointing to a constructor introduced by a using-declaration, recursively). Maybe something like ", including constructors introduced by a using-declaration [namespace.udecl]" or ", including inherited constructors [namespace.udecl]" is good enough. What do you think?

@tkoeppe tkoeppe removed the after-motions Pull request is to be applied after the pending edits from WG21 straw polls have been applied. label Apr 3, 2018
@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Apr 3, 2018
If such a constructor is selected to perform the initialization
of an object of class type, all subobjects other than the base class
from which the constructor originated
are implicitly initialized\iref{class.inhctor.init}.
\begin{note}
A member of a derived class is sometimes preferred to a member of a base class
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editorial meeting consensus: Do not move this note, change "member" to "constructor".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Jun 7, 2018
The effects of using-declarations naming member functions
are discussed in other parts of the standard.
The effects of initializing with an inherited constructor are
discussed elsewhere, too.
@zygoloid zygoloid merged commit d3f80a4 into cplusplus:master Jul 6, 2018
@jensmaurer jensmaurer deleted the b40 branch July 8, 2018 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants