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

[class.mem] Deduction guides do not declare new members #3932

Merged
merged 1 commit into from Oct 18, 2020

Conversation

sdkrystian
Copy link
Contributor

The intent in P0091R3 is pretty clear (emphasis mine):

Deduction guides must name a class template and must be introduced within the same semantic scope of the class template, but they do not becomes members of that scope (i.e if that scope is a class).

Copy link
Member

@jensmaurer jensmaurer left a comment

Choose a reason for hiding this comment

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

Please don't mix unrelated changes in the same commit.

@@ -513,6 +513,8 @@
if it is
\begin{itemize}
\item a friend declaration\iref{class.friend},
\item a \grammarterm{deduction-guide}\iref{temp.deduct.guide},
\item a \grammarterm{template-declaration} whose \grammarterm{declaration} is one of the above,
Copy link
Member

Choose a reason for hiding this comment

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

I agree that a deduction-guide does not declare a new member (as explained in the commit comment), but here materializes another rule that isn't mentioned. (Plus, it seems to me a template friend is still a friend declaration of sorts.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please don't mix unrelated changes in the same commit.

I wouldn't say that it's entirely unrelated, so should I just change the commit message & PR name?

It seems to me a template friend is still a friend declaration of sorts.

I consider a friend template to be a friend declaration as much as I consider a class template to be a class declaration.

here materializes another rule that isn't mentioned

I'm assuming that you're referring to deduction-guides declared outside of a template-declaration. With respect to such declarations, I don't see any wording (normative or informative) that explicitly states such deduction-guides can be declared, however we can deduce that it's allowed from:

  • grammar (a deduction-guide (without a template-head) is a declaration as well as a member-declaration) and,
  • normative wording ([over.match.class.deduct] p1.4 says "if any" when referring to the template parameters; you can't explicitly specialize a deduction guide so the only context where this would occur is when there is no template-head)

@zygoloid zygoloid added this to the C++23 milestone Sep 18, 2020
@zygoloid zygoloid merged commit 17e732c into cplusplus:master Oct 18, 2020
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