Skip to content

Commit 9c3bf28

Browse files
committed
[temp] Clarify what a template declares
1 parent b6d9e27 commit 9c3bf28

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

source/templates.tex

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,29 @@
127127
\end{note}
128128

129129
\pnum
130-
In a
131-
\grammarterm{template-declaration},
132-
explicit specialization, or explicit instantiation the
133-
\grammarterm{init-declarator-list}
134-
in the declaration shall contain at most one declarator.
135-
When such a declaration is used to declare a class template,
136-
no declarator is permitted.
130+
A \grammarterm{template-declaration} or \grammarterm{explicit-specialization}
131+
declares a class or a class template if its \grammarterm{declaration} contains no
132+
\grammarterm{declarator} and it does not declare an alias template\iref{temp.alias} or
133+
deduction guide\iref{temp.deduct.guide}; the \grammarterm{decl-specifier-seq} of such a
134+
declaration shall contain a single \grammarterm{defining-type-specifier} that is either
135+
a \grammarterm{class-specifier}, \grammarterm{enum-specifier}, or an \grammarterm{elaborated-type-specifier}.
136+
An \grammarterm{explicit-instantiation} that contains no \grammarterm{declarator}
137+
is an explicit instantiation of a class; such a declaration shall contain an
138+
\grammarterm{elaborated-type-specifier}, itself containing a \grammarterm{simple-template-id}.
139+
140+
\pnum
141+
A \grammarterm{template-declaration} or \grammarterm{explicit-specialization}
142+
shall contain a single \grammarterm{declarator} if it does not declare a class,
143+
class template, concept\iref{temp.concept}, alias template\iref{temp.alias} or
144+
deduction guide\iref{temp.deduct.guide}. Similarly, an \grammarterm{explicit-instantiation}
145+
that does not explicitly instantiate a class shall contain a single \grammarterm{declarator}.
146+
147+
\pnum
148+
A \grammarterm{template-declaration} or \grammarterm{explicit-specialization} containing
149+
a \grammarterm{declarator} that does not declare a variable or variable template declares
150+
a function or function template. Similarly, an \grammarterm{explicit-instantiation} containing
151+
a \grammarterm{declarator} that does not explicitly instantiate a variable is an explicit
152+
instantiation of a function.
137153

138154
\pnum
139155
\indextext{template name!linkage of}%
@@ -6561,7 +6577,8 @@
65616577
\pnum
65626578
An explicit instantiation shall not use
65636579
a \grammarterm{storage-class-specifier}\iref{dcl.stc}
6564-
other than \keyword{thread_local}.
6580+
other than \keyword{thread_local}. The \grammarterm{init-declarator}
6581+
of an explicit instantiation (if any) shall not contain an \grammarterm{initializer}.
65656582
An explicit instantiation of a
65666583
function template,
65676584
member function of a class template, or
@@ -6572,13 +6589,6 @@
65726589
shall appertain to an explicit instantiation.
65736590

65746591
\pnum
6575-
If the explicit instantiation is for a class or member class, the
6576-
\grammarterm{elaborated-type-specifier} in the \grammarterm{declaration}
6577-
shall include a \grammarterm{simple-template-id};
6578-
otherwise, the \grammarterm{declaration}
6579-
shall be a \grammarterm{simple-declaration} whose \grammarterm{init-declarator-list}
6580-
comprises a single \grammarterm{init-declarator}
6581-
that does not have an \grammarterm{initializer}.
65826592
If the explicit instantiation is for
65836593
a function or member function,
65846594
the

0 commit comments

Comments
 (0)