Title
Problems in initialization example
Status
c++11
Section
6.9.3.2 [basic.start.static]
Submitter
Jason Merrill

Created on 2010-08-31.00:00:00 last changed 123 months ago

Messages

Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting.]

Date: 2010-11-15.00:00:00

Proposed resolution (November, 2010):

Change the comments in the example in 6.9.3.2 [basic.start.static] paragraph 3 as follows:

  inline double fd() { return 1.0; }
  extern double d1;
  double d2 = d1;     // unspecified:
                      // may be statically initialized to 0.0 or
                      // dynamically initialized to 1.0 to 0.0 if d1 is dynamically initialized, or 1.0 otherwise
  double d1 = fd();   // may be initialized statically or dynamically to 1.0

(The note should also be in running text following the bulleted list instead of appearing as a bulleted item, as well.)

Date: 2016-02-15.00:00:00

The note in 6.9.3.2 [basic.start.static] paragraph 3 contains the following example:

  inline double fd() { return 1.0; }
  extern double d1;
  double d2 = d1;     // unspecified:
                      // may be statically initialized to 0.0 or
                      // dynamically initialized to 1.0
  double d1 = fd();   // may be initialized statically to 1.0

The comment for d2 overlooks the third possibility: if both d1 and d2 are dynamically initialized, d2 will be initialized to 0.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3297
2011-04-10 00:00:00adminsetstatus: ready -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3047
2010-11-29 00:00:00adminsetstatus: open -> ready
2010-08-31 00:00:00admincreate