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

[temp.mem.enum] Fix consistency of example with [temp.inst] (editorial) #7558

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thebrandre
Copy link

The example is inconsistent with [temp.inst] p3, which states the following:

The implicit instantiation of a class template specialization causes

  • the implicit instantiation of the declarations, but not of the definitions, of [...] scoped member enumerations [...]; and
  • the implicit instantiation of the definitions of [...] unscoped member enumerations [...]

Hence, the example can be fixed by either (1) omitting the instantiation or (2) by replacing the unscoped with a scoped enumeration. Since the implicit instantiation does not contribute to the point of [temp.mem.enum], the inconsistency can be solved most easily with alternative (1).

The example was taken exactly as is from DR1206, where it already seems to be an accidental copy-paste mishap because it is not important for the statement it is trying to make.
If one is willing to assume that, it is just an editorial issue.

Note: the example as is does not compile with any of the major compilers.
See here on Compiler Explorer: https://godbolt.org/z/xjM15MjP8

The example is inconsistent with [temp.inst] p3, which states the following:
"The implicit instantiation of a class template specialization causes
 - the implicit instantiation of the declarations, but not of the definitions,
   of [...] scoped member enumerations [...]; and
 - the implicit instantiation of the definitions of [...]
   unscoped member enumerations [...]"

Hence, the example can be fixed by either (1) omitting the instantiation or
(2) by replacing the unscoped with a scoped enumeration.
Since the implicit instantiation does not contribute to the point of
[temp.mem.enum], the inconsistency can be solved most easily with alternative (1).

Note: The example was originally taken from DR1206.
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.

Looks good.

@jensmaurer
Copy link
Member

@thebrandre, if you wish for your real name to appear in the commit history, you need to configure it in github.

@thebrandre
Copy link
Author

@jensmaurer Thanks for pointing that out! I just updated my GitHub profile.

@lprv
Copy link
Contributor

lprv commented Jan 12, 2025

This is related to CWG1485

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.

4 participants