Created on2000-02-23.00:00:00 last changed277 months ago
Proposed resolution (10/00):
In 13.8 [temp.res] paragraph 7, add the followingimmediately preceding the note:
If a type used in a non-dependent name is incomplete at the point atwhich a template is defined but is complete at the point at which aninstantiation is done, and if the completeness of that type affectswhether or not the program is well-formed or affects the semantics ofthe program, the program is ill-formed; no diagnostic is required.
At what point are semantic constraints applied to uses ofnon-dependent names in template definitions? According to_N4868_.13.8.4 [temp.nondep], such names are looked upand bound at the point at which they are used, i.e., the point ofdefinition and not the point of instantiation. However, the text doesnot mention the checking of semantic constraints.
Contrast this omission with the treatment of names in defaultargument expressions given in9.3.4.7 [dcl.fct.default] paragraph 5, wherethe treatment of semantic constraints is explicit:
The names in the expression are bound, and the semantic constraintsare checked, at the point where the default argument expressionappears.The following code is an example of where this distinction matters:
struct S; template <class T> struct Q { S s; // incomplete type if semantic constraints // are applied in the definition context }; struct S { }; // Point of instantiation of Q<int>; S is complete here Q<int> si;There is real-world code that depends on late checking of semanticconstraints. The Standard should be explicit about whether this codeis broken or not.| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2003-04-25 00:00:00 | admin | set | status: dr -> tc1 |
| 2000-11-18 00:00:00 | admin | set | status: ready -> dr |
| 2000-05-21 00:00:00 | admin | set | messages: +msg329 |
| 2000-05-21 00:00:00 | admin | set | status: open -> ready |
| 2000-02-23 00:00:00 | admin | create | |