Movatterモバイル変換


[0]ホーム

URL:


Issue 1850 - WG21 CWG Issues
Title
Differences between definition context and point of instantiation
Status
cd4
Section
13.8 [temp.res]
Submitter
Richard Smith

Created on2014-02-04.00:00:00 last changed109 months ago

Messages

msg5412 (view)
Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

msg4851 (view)
Date: 2014-02-15.00:00:00

Proposed resolution (February, 2014):

Change 13.8 [temp.res] paragraph 8 as follows:

...If atype used in a non-dependent name is incomplete at the pointat which a template is defined but is complete at the point at which aninstantiation is done, and if the completeness of that type affects whetheror not the program is well-formed or affects the semantics of theprogram,hypothetical instantiation of a template immediatelyfollowing its definition would be ill-formed due to a construct that doesnot depend on a template parameter, the program is ill-formed; nodiagnostic is required. If the interpretation of such a construct in thehypothetical instantiation is different from the interpretation of thecorresponding construct in any actual instantiation of the template,the program is ill-formed; no diagnostic is required.[Note:This can happen in situations including the following:
  • a type used in a non-dependent name is incomplete at thepoint at which a template is defined but is complete at the point at whichan instantiation is performed, or

  • an instantiation uses a default argument or default templateargument that had not been defined at the point at which the template wasdefined, or

  • constant expression evaluation (7.7 [expr.const]) withinthe template instantiation uses

    • the value of aconst object of integral or unscopedenumeration type or
    • the value of aconstexpr object or

    • the value of a reference or

    • the definition of aconstexpr function,

    and that entity was not defined when the template was defined,or

  • a class template specialization or variable templatespecialization that is specified by a non-dependentsimple-template-id is used by the template, and either it isinstantiated from a partial specialization that was not defined when thetemplate was defined or it names an explicit specialization that wasnot declared when the template was defined.

end note] [Note: If atemplate is instantiated...

msg4850 (view)
Date: 2014-02-04.00:00:00

Various characteristics of entities referred to by a non-dependentreference in a template can change between the definition context andthe point of instantiation of a specialization of that template. Theseinclude initialization (which affects whether an object can be usedin a constant expression), function and template default arguments,and the completeness of types. There is implementation divergenceas to whether these are checked in the definition context or at thepoint of instantiation. Presumably a rule is needed to make itill-formed, no diagnostic required, if the validity of such areference changes between the two contexts.

History
DateUserActionArgs
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: +msg5412
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-03-03 00:00:00adminsetmessages: +msg4851
2014-02-04 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp