- Title
- template-name as simple-type-name vs injected-class-name
- Status
- cd5
- Section
- 9.2.9.3 [dcl.type.simple]
- Submitter
- Daveed Vandevoorde
Created on 2016-12-10.00:00:00 last changed 55 months ago
Messages
Date: 2018-11-15.00:00:00
Proposed resolution (November, 2018): Change 9.2.9.3 [dcl.type.simple] paragraph 2 as follows:
The simple-type-specifier auto
is a placeholder for a
type to be deduced
(9.2.9.7 [dcl.spec.auto]). A type-specifier of
the form typename opt
nested-name-specifieropt template-name is a placeholder for a
deduced class type
(9.2.9.8 [dcl.type.class.deduct]). The template-name
shall name a class template
that is not
an injected-class-name. [Note: An
injected-class-name is never interpreted as
a template-name in contexts where
a type-specifier may appear
(13.8.2 [temp.local]). —end note]
The other simple-type-specifiers specify...
Date: 2022-02-18.07:47:23
Suggested resolution: Deleting the wording in question and replacing it with a
cross-reference to 13.8.2 [temp.local], which makes it
clear that the injected-class-name is a type-name and
not a template-name in this context, would seem to address
the problem adequately.
Date: 2019-02-15.00:00:00
[Accepted as a DR at the February, 2019 meeting.] Paper P0091R3
has the following example: The intent was presumably to avoid breaking existing code,
but the new wording in 9.2.9.3 [dcl.type.simple] paragraph 2
appears to make the expression X(b, e) ill-formed:
template<typename T> struct X {
template<typename Iter>
X(Iter b, Iter e) { /* ... */ }
template<typename Iter>
auto foo(Iter b, Iter e) {
return X(b, e); // X<U> to avoid breaking change
}
template<typename Iter>
auto bar(Iter b, Iter e) {
return X<Iter::value_type>(b, e); // Must specify what we want
}
};
A type-specifier of the form
typename opt
nested-name-specifieropt template-name is a
placeholder for a deduced class type
(9.2.9.8 [dcl.type.class.deduct]). The template-name shall
name a class template that is not an injected-class-name.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-02-18 07:47:23 | admin | set | messages: + msg6716 |
| 2020-12-15 00:00:00 | admin | set | messages: + msg6394 |
| 2020-12-15 00:00:00 | admin | set | status: drafting -> cd5 |
| 2016-12-10 00:00:00 | admin | create | |