Movatterモバイル変換


[0]ホーム

URL:


Issue 206 - WG21 CWG Issues
Title
Semantic constraints on non-dependent names
Status
tc1
Section
_N4868_.13.8.4 [temp.nondep]
Submitter
Mike Miller

Created on2000-02-23.00:00:00 last changed277 months ago

Messages

msg329 (view)
Date: 2000-04-15.00:00:00

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.
msg272 (view)
Date: 2021-02-24.00:00:00

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
DateUserActionArgs
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetstatus: ready -> dr
2000-05-21 00:00:00adminsetmessages: +msg329
2000-05-21 00:00:00adminsetstatus: open -> ready
2000-02-23 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp