-
Notifications
You must be signed in to change notification settings - Fork 769
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
base: main
Are you sure you want to change the base?
Conversation
source/templates.tex
Outdated
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} |
There was a problem hiding this comment.
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.
And please fix the Travis failure. |
0fd850e
to
1ba571a
Compare
@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. |
The wording changes here are substantial; let's have CWG give them a look over before we apply them. |
Could you please rebase? |
I'll have it rebased tomorrow |
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.