Created on2012-03-25.00:00:00 last changed109 months ago
[Moved to DR at the November, 2014 meeting.]
Notes from the April, 2013 meeting:
The proposed resolution interacts with N3649 (generic lambdas),adopted at this meeting, and this issue has returned to "review"status to allow any necessary changes to be made.
Proposed resolution (October, 2012):
Change 13.9.2 [temp.inst] paragraph 1 as follows:
Unless a class template specialization has been explicitlyinstantiated (13.9.3 [temp.explicit]) or explicitly specialized(13.9.4 [temp.expl.spec]), the class template specialization isimplicitly instantiated when the specialization is referenced in acontext that requires a completely-defined object type or when thecompleteness of the class type affects the semantics of the program.[Note: Within a template declaration, a local class orenumeration and the members of a local class are never considered tobe entities that can be separately instantiated (this includes theirdefault arguments,exception-specifications, and non-static datamember initializers, if any). As a result, the dependent names arelooked up, the semantic constraints are checked, and any templatesused are instantiated as part of the instantiation of the entitywithin which the local class or enumeration is declared. —endnote] The implicit instantiation of a class templatespecialization...
Do local classes of function templates get the same treatment asmember classes of class templates? In particular, is their definitiononly instantiated when they are required? For example,
template<typename T> void f() { struct B { T t; }; } int main() { f<void>(); }Implementations vary on this question.
(This question is superficially similar to the one inissue 1253. However, the entities inview in that issue can be named and defined outside the containingtemplate and thus can be explicitly specialized, none of which istrue for local classes of function templates.)
It should also be noted that the resolution of this issue shouldapply as well to local enumeration types.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
| 2015-05-25 00:00:00 | admin | set | status: dr -> drwp |
| 2015-04-13 00:00:00 | admin | set | messages: +msg5416 |
| 2014-11-24 00:00:00 | admin | set | status: ready -> dr |
| 2014-03-03 00:00:00 | admin | set | status: review -> ready |
| 2013-05-03 00:00:00 | admin | set | messages: +msg4322 |
| 2013-05-03 00:00:00 | admin | set | status: tentatively ready -> review |
| 2012-11-03 00:00:00 | admin | set | messages: +msg4080 |
| 2012-11-03 00:00:00 | admin | set | status: open -> tentatively ready |
| 2012-03-25 00:00:00 | admin | create | |