Title
§[ios.base.cons] `ios_base` members may not have indeterminate values after construction
Status
new
Section
[ios.base.cons][ios.base.locales]
Submitter
S. B. Tam

Created on 2025-01-12.00:00:00 last changed 3 days ago

Messages

Date: 2025-02-07.22:39:43

Proposed resolution:

This wording is relative to N5001.

  1. Modify [ios.base.locales] as indicated:

    ios_base();
    

    -1- Effects: Each `ios_base` member has an unspecified (possibly indeterminate or erroneous) value after construction. The object's members shall be initialized by calling `basic_ios::init` before the object's first use or before it is destroyed, whichever comes first; otherwise the behavior is undefined.

  2. Modify [ios.base.cons] as indicated:

    locale getloc() const;
    

    -4- Returns: If no locale has been imbued, a copy of the global C++ locale, `locale()`, in effect at the time of constructionthe last `basic_ios::init` call on the current object. Otherwise, returns the imbued locale, to be used to perform locale-dependent input and output operations.

Date: 2025-02-15.00:00:00

[ 2025-02-07; Reflector poll ]

Set priority to 3 after reflector poll.

"First part is NAD, can use e.g. placement new to force indeterminate values, and it's not observable by well-defined progams anyway."

Date: 2025-01-12.00:00:00

[ios.base.cons] specifies that

Each `ios_base` member has an indeterminate value after construction.

However

  • If the `ios_base` object has static storage duration, the members would have been zero-initialized.

  • If the `ios_base` object has automatic storage duration, the members would have erroneous values.

In either case, the constructor cannot cause the members to have indeterminate values after construction.

A related problem is that [ios.base.locales] requires `ios_base::getloc` to return:

If no locale has been imbued, a copy of the global C++ locale, `locale()`, in effect at the time of construction.

However, according to [ios.base.cons], the corresponding member is not initialized until `basic_ios::init` is called.

History
Date User Action Args
2025-02-07 22:39:43adminsetmessages: + msg14620
2025-01-18 16:17:52adminsetmessages: + msg14541
2025-01-12 00:00:00admincreate