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

[utilities, depr] Replace "member typedef" with "nested type" #1773

Closed
wants to merge 2 commits into from

Conversation

cpplearner
Copy link
Contributor

[class.mem]/3:

Nested types are classes (12.1, 12.2.5) and enumerations (10.2) declared in the class and arbitrary types declared as members by use of a typedef declaration (10.1.3) or alias-declaration.

In most cases there's no normative change because the member must name a pre-existing type.

aligned_storage and aligned_union are special-cased because their member type may name a new type. In particular, aligned_storage::type is defined as a nested class type in both libstdc++ and libc++.

@jensmaurer
Copy link
Member

In a phrasing like "the member typedef X names ..." or "the member typedef is T", I think this change makes things worse: We know we can't have a fresh type here, so why use a phrasing that allows this?

I agree the change for aligned_storage, aligned_union is good (it's not talking about a pre-existing type), but it seems borderline editorial. (Although it's probably unobservable whether something is a typedef to something else that cannot otherwise be named or is a new type by itself.)

@cpplearner
Copy link
Contributor Author

"Member typedef" is not a defined term, and does not clearly indicate that the member can also be declared using an alias-declaration.

"Nested type" is already used in e.g. [container.insert.return]/1, [move.iterator]/1, [depr.func.adaptor.typedefs]/4, and in these cases the types have to be synonyms for pre-existing types (or specializations of a pre-existing template).

@jwakely
Copy link
Member

jwakely commented Oct 19, 2017

I think "a nested type type that names ..." makes things worse. A typedef names another type, a nested type doesn't necessarily.

does not clearly indicate that the member can also be declared using an alias-declaration

I disagree, since there's no semantic difference between the two. [dcl.typedef] p2 "A typedef-name can also be introduced by an alias-declaration."

"Member typedef" seems clear to me, with the obvious meaning, and we do say "typedef member" in [class.mfct]

@jensmaurer
Copy link
Member

I'd rather replace "nested type", when talking about synonyms, from [container.insert.return]/1, [move.iterator]/1, [depr.func.adaptor.typedefs]/4 than go the other way.

So, in the interest of progress, this pull request could go forward if it would only propose change 7b2c0db.

For the rest, I agree that "member typedef" might be viewed as excluding alias-declarations (although the difference is unobservable, so it doesn't matter). What about "The member X is a synonym for the type T." as the uniform standard phrasing?

@zygoloid zygoloid added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Nov 12, 2017
@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 22, 2017

Feel free to reopen if and when you'd like to address the above issues.

@tkoeppe tkoeppe closed this Nov 22, 2017
@cpplearner cpplearner deleted the memty branch January 18, 2018 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase The pull request needs a git rebase to resolve merge conflicts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants