Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Open
@xmh0511

Description

@xmh0511
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.