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


421. Is rvalue.field an rvalue?

Section:7.6.1.5  [expr.ref]    Status:CD1    Submitter:Gabriel Dos Reis    Date:15 June 2003

[Voted into WP at March 2004 meeting.]

Consider

  typedef    struct {      int a;    } A;  A f(void)  {    A a;    return a;  }  int main(void)  {    int* p = &f().a;   // #1  }

Should #1 be rejected? The standard is currently silent.

Mike Miller:I don't believe the Standard is silent on this. I will agree that thewording of 7.6.1.5 [expr.ref] bullet 4.2 isunfortunate, as it is subject to misinterpretation. It reads,

If E1 is an lvalue, then E1.E2 is an lvalue.
The intent is, "and not otherwise."

Notes from October 2003 meeting:

We agree the reference should be an rvalue, and a change alongthe lines of that recommended by Mike Miller is reasonable.

Proposed Resolution (October 2003):

Change the second bullet of 7.6.1.5 [expr.ref] paragraph 4to read:

If E1 is an lvalue, then E1.E2 is an lvalue; otherwise, it is an rvalue.



[8]ページ先頭

©2009-2026 Movatter.jp