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


2933. Dangling references

Section:7.2.2  [expr.type]    Status:CD7    Submitter:Brian Bi    Date:2024-09-04

[Accepted as a DR at the November, 2024 meeting.]

Issue 453 clarified that there are noempty lvalues, and undefined behavior ensues when trying to createone. However, the wording now does not specify the behavior ofdangling references, where the storage of the referenced object hasgone away.

Proposed resolution (approved by CWG 2024-11-08):

  1. Change in 6.9.2 [basic.fundamental] paragraph 4 as follows:

    A pointer value P is valid in the context of an evaluation E if Pisa pointer to function or a null pointer value, or if itis a pointer to or past the end of an object O and E happens beforethe end of the duration of the region of storage for O. If a pointervalue P is used in an evaluation E and P is not valid in the contextof E, then ...
  2. Change in 7.2.2 [expr.type] paragraph 1 as follows:

    If an expression initially has the type “reference to T”(9.3.4.3 [dcl.ref], 9.5.4 [dcl.init.ref]), the typeis adjusted to T prior to any further analysis; the valuecategory of the expression is not altered.The expression designatesLetX be the object or function denoted by thereference, and the expression is an lvalue or an xvalue,depending on the expression.If a pointer toXwould be valid in the context of the evalution of the expression(6.9.2 [basic.fundamental]), the result designatesX;otherwise, the behavior is undefined.



[8]ページ先頭

©2009-2026 Movatter.jp