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.explicit] Fix unclear reference to elaborated-type-specifier #3872

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

Conversation

sdkrystian
Copy link
Contributor

It is unclear what elaborated-type-specifier we are referring to, and the current wording does not do a good job specifying what form the explicit instantiation should take.

Comment on lines 6575 to 6577
If the explicit instantiation is for a class or member class, the \grammarterm{declaration}
shall consist of a single \grammarterm{elaborated-type-specifier} that includes a
\grammarterm{simple-template-id}; otherwise, the \grammarterm{declaration}
Copy link
Member

Choose a reason for hiding this comment

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

I think the "shall consist of a single" part of this rule belongs in [temp.pre]p5:

When such a declaration is used to declare a class template or class template specialization, no declarator is permitted.

As written, this doesn't seem quite right: requiring the declaration to consist of only an elaborated-type-specifier would disallow attributes.

But there's something really fishy about the rules here in general: we're starting (in both [temp.pre] and here) by assuming we know whether we're explicitly instantiating a class or something else, and there's no rules to say when we are doing so.

What we really mean is something like: if there is no declarator, then the template, template specialization, or explicit instantiation declaration is declaring a class or class template, and the decl-specifier-seq shall contain a single defining-type-specifier that is either a class-specifier, an enum-specifier, or an elaborated-type-specifier. And for an explicit instantiation, it shall be an elaborated-type-specifier that either includes a simple-template-id or whose nested-name-specifier includes a simple-template-id.

@jensmaurer
Copy link
Member

And please fix the Travis failure.

@sdkrystian sdkrystian force-pushed the patch-36 branch 3 times, most recently from 0fd850e to 1ba571a Compare March 15, 2020 21:57
@sdkrystian
Copy link
Contributor Author

@zygoloid I added a commit which specifies what a template actually declares in [temp.pre]... however, this is a little difficult without being very wordy.

@zygoloid
Copy link
Member

The wording changes here are substantial; let's have CWG give them a look over before we apply them.

@jensmaurer jensmaurer added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Mar 15, 2021
@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 12, 2023

Could you please rebase?

@sdkrystian
Copy link
Contributor Author

I'll have it rebased tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG. 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

4 participants