Title
Incorrect comments in braced-init-list assignment example
Status
cd2
Section
7.6.19 [expr.ass]
Submitter
Daniel Krügler

Created on 2009-04-05.00:00:00 last changed 143 months ago

Messages

Date: 2009-10-15.00:00:00

[Voted into WP at October, 2009 meeting.]

Date: 2009-07-15.00:00:00

Proposed resolution (July, 2009):

Change the example in 7.6.19 [expr.ass] paragraph 9 as follows:

[Example:

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

end example]

Date: 2009-04-05.00:00:00

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

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

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

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

or even

    // meaning z.operator=({1,2}), resolves to
    // z.operator=(complex<double>(1,2)
History
Date User Action Args
2010-03-29 00:00:00adminsetstatus: dr -> cd2
2009-11-08 00:00:00adminsetmessages: + msg2443
2009-11-08 00:00:00adminsetstatus: ready -> dr
2009-08-03 00:00:00adminsetmessages: + msg2154
2009-08-03 00:00:00adminsetstatus: open -> ready
2009-04-05 00:00:00admincreate