This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

379. nonsensical ctype::do_widen() requirement

Section: 30.4.2.2.3 [locale.ctype.virtuals] Status: CD1 Submitter: Martin Sebor Opened: 2002-09-06 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [locale.ctype.virtuals].

View all issues with CD1 status.

Discussion:

The last sentence in 22.2.1.1.2, p11 below doesn't seem to make sense.

  charT do_widen (char c) const;

  -11- Effects: Applies the simplest reasonable transformation from
       a char value or sequence of char values to the corresponding
       charT value or values. The only characters for which unique
       transformations are required are those in the basic source
       character set (2.2). For any named ctype category with a
       ctype<charT> facet ctw and valid ctype_base::mask value
       M (is(M, c) || !ctw.is(M, do_widen(c))) is true.

Shouldn't the last sentence instead read

       For any named ctype category with a ctype<char> facet ctc
       and valid ctype_base::mask value M
       (ctc.is(M, c) || !is(M, do_widen(c))) is true.

I.e., if the narrow character c is not a member of a class of characters then neither is the widened form of c. (To paraphrase footnote 224.)

Proposed resolution:

Replace the last sentence of 30.4.2.2.3 [locale.ctype.virtuals], p11 with the following text:

       For any named ctype category with a ctype<char> facet ctc
       and valid ctype_base::mask value M,
       (ctc.is(M, c) || !is(M, do_widen(c))) is true.

[Kona: Minor edit. Added a comma after the M for clarity.]

Rationale:

The LWG believes this is just a typo, and that this is the correct fix.