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


855. Incorrect comments inbraced-init-list assignment example

Section:7.6.19  [expr.assign]    Status:CD2    Submitter:Daniel Krügler    Date:5 April, 2009

[Voted into WP at October, 2009 meeting.]

7.6.19 [expr.assign] paragraph 9 has the following example:

    complex<double> z;    z = { 1,2 };      // meaningz.operator=(1,2)    z += { 1, 2 };    // meaningz.operator+=(1,2)

These comments make it look as if the assignment operator takes twoarguments, which is obviously not the case. It would be better if thecomments read something like

     // meaningz.operator=(complex<double>(1,2))

or even

    // meaningz.operator=({1,2}), resolves to    //z.operator=(complex<double>(1,2)

Proposed resolution (July, 2009):

Change the example in 7.6.19 [expr.assign] paragraph 9 asfollows:

[Example:

  complex<double> z;  z = { 1,2 };        // meaningz.operator=({1,2})  z += { 1, 2 };      // meaningz.operator+=({1,2})  int a, b;  a = b = { 1 };      // meaninga=b=1;  a = { 1 } = b;      // syntax error

end example]




[8]ページ先頭

©2009-2026 Movatter.jp