Title
Contradiction in regex_constants
Status
c++14
Section
[re.matchflag]
Submitter
BSI

Created on 2010-08-25.00:00:00 last changed 130 months ago

Messages

Date: 2014-02-14.07:07:05

Proposed resolution:

Ammend [bitmask.types] p3:

Here, the names C0, C1, etc. represent bitmask elements for this particular bitmask type. All such elements have distinct, nonzero values such that, for any pair Ci and Cj where i != j, Ci & Ci is nonzero and Ci & Cj is zero. Additionally, the value 0 is used to represent an empty bitmask, in which no bitmask elements are set.

Add the following sentence to [re.matchflag] paragraph 1:

1 The type regex_constants::match_flag_type is an implementation-defined bitmask type (17.5.2.1.3). The constants of that type, except for match_default and format_default, are bitmask elements. The match_default and format_default constants are empty bitmasks. Matching a regular expression against a sequence of characters [first,last) proceeds according to the rules of the grammar specified for the regular expression object, modified according to the effects listed in Table 136 for any bitmask elements set.

Date: 2014-02-13.00:00:00

[ 2014-02-13 Issaquah: ]

Date: 2011-11-21.23:14:17

[ 2011 Bloomington ]

It appears the key problem is the phrasing of the bitmask requirements. Jeremiah supplies updated wording.

Pete Becker has also provided an alternative resolution.

Ammend [bitmask.types]:

Change the list of values for "enum bit mask" in p2 from

V0 = 1 << 0, V1 = 1 << 1, V2 = 1 << 2, V3 = 1 << 3, ....

to

V0 = 0, V1 = 1 << 0, V2 = 1 << 1, V3 = 1 << 2, ....

Here, the names C0, C1, etc. represent bitmask elements for this particular bitmask type. All such non-zero elements have distinct values such that, for any pair Ci and Cj where i != j, Ci & Ci is nonzero and Ci & Cj is zero.

Change bullet 3 of paragraph 4:

TheA non-zero value Y is set in the object X if the expression X & Y is nonzero.

Date: 2010-11-03.00:00:00

[ 2010-11-03 Daniel comments and provides a proposed resolution: ]

The proposed resolution is written against N3126 and considered as a further improvement of the fixes suggested by n3110.

Add the following sentence to [re.matchflag] paragraph 1:

1 The type regex_constants::match_flag_type is an implementation-defined bitmask type (17.5.2.1.3). Matching a regular expression against a sequence of characters [first,last) proceeds according to the rules of the grammar specified for the regular expression object, modified according to the effects listed in Table 136 for any bitmask elements set. Type regex_constants::match_flag_type also defines the constants regex_constants::match_default and regex_constants::format_default.

Date: 2010-10-31.00:00:00

[ 2010-10-31 Daniel comments: ]

Strictly speaking, a bitmask type cannot have any element of value 0 at all, because any such value would contradict the requirement expressed in [bitmask.types] p. 3:

for any pair Ci and Cj, Ci & Ci is nonzero

So, actually both regex_constants::match_default and regex_constants::format_default are only constants of the type regex_constants::match_flag_type, and no bitmask elements.

Date: 2010-10-31.22:53:50

[ Resolution proposed by ballot comment: ]

One of the bitmask elements should be removed from the declaration and should be defined separately, in the same manner as ios_base::adjustfield, ios_base::basefield and ios_base::floatfield are defined by [ios::fmtflags] p.2 and Table 120. These are constants of a bitmask type, but are not distinct elements, they have more than one value set in the bitmask. regex_constants::format_default should be specified as a constant with the same value as regex_constants::match_default.

Date: 2010-10-31.22:53:50

Addresses GB-127

The Bitmask Type requirements in [bitmask.types] p.3 say that all elements on a bitmask type have distinct values, but [re.matchflag] defines regex_constants::match_default and regex_constants::format_default as elements of the bitmask type regex_constants::match_flag_type, both with value 0. This is a contradiction.

History
Date User Action Args
2014-02-27 17:03:20adminsetstatus: wp -> c++14
2014-02-20 13:52:38adminsetstatus: immediate -> wp
2014-02-14 07:07:05adminsetstatus: open -> immediate
2011-08-18 17:19:16adminsetmessages: + msg5870
2011-08-18 17:19:16adminsetmessages: + msg5869
2011-08-18 17:19:16adminsetstatus: deferred -> open
2010-11-13 16:48:25adminsetstatus: open -> deferred
2010-11-03 21:48:11adminsetmessages: + msg5289
2010-11-03 21:48:11adminsetmessages: + msg5288
2010-10-31 22:53:50adminsetmessages: + msg5223
2010-10-31 22:53:50adminsetmessages: + msg5222
2010-10-24 03:04:13adminsetmessages: + msg4942
2010-08-25 00:00:00admincreate