3910. The effects of including <iostream> on initialization are not yet precisely specified

Section: 31.4.2 [iostream.objects.overview] Status: New Submitter: Jiang An Opened: 2023-03-27 Last modified: 2023-05-24

Priority: 4

View all other issues in [iostream.objects.overview].

View all issues with New status.

Discussion:

LWG 3878 specified the effects of importing standard library modules on initialization. However, the effects of including <iostream> are not yet precisely specified. A hostile reading may consider this to allow the ios_base::Init variable to be a function-local static variable or an inline variable, which defeats the purpose.

[2023-05-24; Reflector poll]

Set priority to 4 after reflector poll.

Proposed resolution:

This wording is relative to N4944.

  1. Change 31.4.2 [iostream.objects.overview]/5 as indicated:

    -5- The results of including <iostream> in a translation unit shall be as if <iostream> defined an instance of ios_base::Init with static storage duration ordered initialization (6.9.3.3 [basic.start.dynamic]). Each C++ library module (16.4.2.4 [std.modules]) in a hosted implementation shall behave as if it contains an interface unit that defines an unexported ios_base::Init variable with ordered initialization (6.9.3.3 [basic.start.dynamic]).