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

Terms "template declaration" and "template entity" are undefined #5241

Open
xmh0511 opened this issue Jan 29, 2022 · 0 comments
Open

Terms "template declaration" and "template entity" are undefined #5241

xmh0511 opened this issue Jan 29, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jan 29, 2022

[temp.pre] p3 states

A template-declaration is a declaration. A declaration introduced by a template declaration of a variable is a variable template. A variable template at class scope is a static data member template.

we have never defined the term template declaration, and the wording template declaration is used more than one time in clause [temp]. As well, the template also depends on the definition of template declaration.

An entity is templated if it is

  • a template

As far as now, we only define the variable template. Thus, we may augment the definition for template, as well as, clarify the definition of template declaration.

Change [temp.pre] p3 to that

A template-declaration is a declaration, as known as a template declaration. A template-declaration introduces a template of the entity E(if any) introduced by the declaration in it. A variable template at class scope is shall be a static data member template.

The proposal is fine to clarify a simple explicit specialization is not a template, conversely, a partial specialization is a template declaration, and any restriction applying to a templated entity can also apply to the entity defined in it:

template<class T>
struct A;

template<>
struct A<int>{};  // it is not a template declaration


template<class T>
struct B{};

template<class T>
struct B<T*>{
   void fun() requires (sizeof(T)> 1);  // [dcl.dcl.dcl.decl.general] p4 allows it.
};

Compare to defining a template-declaration is a declaration, I prefer to augment [syntax] to be that

X-declaration is a declaration.

That would cover: parameter-declaration, exception-declaration, and so on.

@xmh0511 xmh0511 changed the title Term "template declaration" is undefined Terms "template declaration" and "template entity" are undefined Jan 29, 2022
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

1 participant