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.expl.spec] Is p13 too limited or is it intentional? #6522

Open
Eisenwave opened this issue Aug 27, 2023 · 3 comments
Open

[temp.expl.spec] Is p13 too limited or is it intentional? #6522

Eisenwave opened this issue Aug 27, 2023 · 3 comments

Comments

@Eisenwave
Copy link
Contributor

The paragraph [temp.expl.spec] p13 says:

Whether an explicit specialization of a function or variable template is inline, constexpr, constinit, or consteval is determined by the explicit specialization and is independent of those properties of the template.
Similarly, attributes appearing in the declaration of a template have no effect on an explicit specialization of that template.

First of all, I don't like the wording, because it is not very clear that the consteval wording doesn't apply to variable templates. This should probably use "constexpr function", "inline function", "immediate function", and other clearly defined terms.

Secondly, "constexpr variable" is not defined, and this paragraph makes mention of it indirectly. See also #6521. It should say "constexpr variable" with proper formatting, or "constexpr variable" should be defined.

Thirdly, shouldn't this paragraph apply to member templates too? How come this only applies to function templates, and not member function templates? How come this does not apply to templates of static data members?

@jensmaurer
Copy link
Member

What this says is that the listed keywords on the template declaration have no bearing on an explicit specialization. I think that's clear enough.

I note that a member function is also a function, and a member function template is also a function template. Further, a static data member is a variable.

I'm not seeing a problem here.

@Eisenwave
Copy link
Contributor Author

What this says is that the listed keywords on the template declaration have no bearing on an explicit specialization. I think that's clear enough.

I note that a member function is also a function, and a member function template is also a function template. Further, a static data member is a variable.

I'm not seeing a problem here.

I think you're right, and such a note could be good. It's just that I've seen a lot of wording that mentions member function templates explicitly, so I've assumed that "function template" is not so all-encompassing.

Still, "constexpr variable" is not defined, and that's worth looking into because wording exists which acts as if it was defined.

@jensmaurer
Copy link
Member

I've seen a lot of wording that mentions member function templates explicitly

Sure, but that is specific for member function templates (excluding non-member function templates). It would be bothersome if there was wording that said "function template and member function template", because that's redundant and gives the impression that the former doesn't include the latter. Specific examples welcome.

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

No branches or pull requests

2 participants