Skip to content

Commit c8cca13

Browse files
burblebeetkoeppe
authored andcommitted
CWG2600 Type dependency of placeholder types
1 parent 58a96f1 commit c8cca13

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

source/expressions.tex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5139,7 +5139,9 @@
51395139
\end{bnf}
51405140

51415141
\pnum
5142-
If a placeholder type\iref{dcl.spec.auto} appears in the
5142+
If a placeholder type\iref{dcl.spec.auto} or
5143+
a placeholder for a deduced class type\iref{dcl.type.class.deduct}
5144+
appears in the
51435145
\grammarterm{type-specifier-seq} of a \grammarterm{new-type-id} or
51445146
\grammarterm{type-id} of a \grammarterm{new-expression},
51455147
the allocated type is deduced as follows:

source/templates.tex

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5016,6 +5016,45 @@
50165016
\end{codeblock}
50175017
\end{example}
50185018

5019+
\pnum
5020+
An initializer is dependent if
5021+
any constituent expression\iref{intro.execution} of the initializer
5022+
is type-dependent.
5023+
A placeholder type\iref{dcl.spec.auto.general} is dependent if
5024+
it designates a type deduced from a dependent initializer.
5025+
5026+
\pnum
5027+
A placeholder for a deduced class type\iref{dcl.type.class.deduct}
5028+
is dependent if
5029+
\begin{itemize}
5030+
\item
5031+
it has a dependent initializer, or
5032+
\item
5033+
it refers to an alias template
5034+
that is a member of the current instantiation and
5035+
whose \grammarterm{defining-type-id} is dependent after
5036+
class template argument deduction\iref{over.match.class.deduct}
5037+
and substitution\iref{temp.alias}.
5038+
\end{itemize}
5039+
5040+
\pnum
5041+
\begin{example}
5042+
\begin{codeblock}
5043+
template<class T, class V>
5044+
struct S { S(T); };
5045+
5046+
template<class U>
5047+
struct A {
5048+
template<class T> using X = S<T, U>;
5049+
template<class T> using Y = S<T, int>;
5050+
void f() {
5051+
new X(1); // dependent
5052+
new Y(1); // not dependent
5053+
}
5054+
};
5055+
\end{codeblock}
5056+
\end{example}
5057+
50195058
\pnum
50205059
A type is dependent if it is
50215060
\begin{itemize}
@@ -5038,6 +5077,10 @@
50385077
\item
50395078
a function type whose exception specification is value-dependent,
50405079
\item
5080+
denoted by a dependent placeholder type,
5081+
\item
5082+
denoted by a dependent placeholder for a deduced class type,
5083+
\item
50415084
denoted by a \grammarterm{simple-template-id}
50425085
in which either the template name is a template parameter or any of the
50435086
template arguments is a dependent type or an expression that is type-dependent

0 commit comments

Comments
 (0)