cplusplus / cplusplus/draft

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

Open
#5,241 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

[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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with [temp.pre] paragraph 3 and compare the terminology rules proposed for [syntax]. Review how “template declaration,” “template-declaration,” and “template entity” are used elsewhere in [temp]. Done means the terminology and specialization cases are consistently defined without leaving the proposal’s alternatives unresolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.