Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


616. Definition of “indeterminate value”

Section:Clause 3  [intro.defs]    Status:CD3    Submitter:Bjarne Stroustrup    Date:2 February 2007

[Moved to DR at the April, 2013 meeting.]

The C++ Standard uses the phrase “indeterminate value”without defining it. C99 defines it as “either an unspecifiedvalue or a trap representation.” Should C++ follow suit?

In addition, 7.3.2 [conv.lval] paragraph 1 says thatapplying the lvalue-to-rvalue conversion to an “object[that] is uninitialized” results in undefined behavior;this should be rephrased in terms of an object with anindeterminate value.

Proposed resolution (October, 2012):

  1. Change 7.3.2 [conv.lval] paragraphs 1 and 2 asfollows (including changing the running text of paragraph 2 intobullets):

  2. A glvalue (7.2.1 [basic.lval]) of a non-function, non-arraytypeT can be converted to a prvalue.53 IfT is an incomplete type, a program that necessitates thisconversion is ill-formed.If the object to which the glvaluerefers is not an object of typeT and is not an object of atype derived fromT, or if the object is uninitialized, aprogram that necessitates this conversion has undefinedbehavior. IfT is a non-class type, the type of theprvalue is the cv-unqualified version ofT. Otherwise, thetype of the prvalue isT.54

    When an lvalue-to-rvalue conversion occurs in an unevaluatedoperand or a subexpression thereof (Clause 7 [expr]) thevalue contained in the referenced object is not accessed.In allother cases, the result of the conversion is determined accordingto the following rules:

  3. Change 7.6.1.5 [expr.ref] paragraph 4 second bullet asfollows:

  4. Change 7.6.4 [expr.mptr.oper] paragraph 6 as follows:

  5. ...The result of a.* expression whose second operand is apointer to a data member isof the same value category(7.2.1 [basic.lval]) as its first operandan lvalueif the first operand is an lvalue and an xvalue otherwise. Theresult of a.* expression whose second operand is a pointerto a member function...

This resolution also resolves issues129,240,312,623, and1013.

(See alsoissue 1213.)

Additional note (August, 2012):

It was observed that the phrase in thefourth bullet of the change to 7.3.2 [conv.lval] paragraph 2that reads “is not a local variable” should probablybe changed to “does not have automatic storageduration,” because objects with static storage duration arezero-initialized and thus cannot have an indeterminate value. Theissue was returned to "review" status for discussion of this point.




[8]ページ先頭

©2009-2026 Movatter.jp