Title
Misleadingly constrained post-condition in the presence of exceptions
Status
open
Section
[re.regex.assign]
Submitter
Jonathan Wakely

Created on 2012-03-08.00:00:00 last changed 108 months ago

Messages

Date: 2015-05-22.19:00:31

Proposed resolution:

This wording is relative to N3376.

template <class string_traits, class A>
  basic_regex& assign(const basic_string<charT, string_traits, A>& s,
    flag_type f = regex_constants::ECMAScript);

[…]

-15- Effects: Assigns the regular expression contained in the string s, interpreted according the flags specified in f. If an exception is thrown, *this is unchanged.

-16- Postconditions: If no exception is thrown, flags() returns f and mark_count() returns the number of marked sub-expressions within the expression.

Date: 2015-05-06.00:00:00

[ 2015-05-06 Lenexa: EricWF to write paper addressing 2136 and 2137 ]

Date: 2021-06-20.15:07:07

[ 2012-10 Portland: Move to Open ]

A favorable resolution clearly depends on a favorable resolution to 2136. There is also a concern that this is just one example of where we would want to apply such a wording clean-up, and which is really needed to resolve both this issue and 2136 is a paper providing the clause 17 wording that gives the guarantee for postcondition paragraphs, and then reviews clauses 18-30 to apply that guarantee consistently. We do not want to pick up these issues piecemeal, as we risk opening many issues in an ongoing process.

Date: 2012-03-08.00:00:00

The post-conditions of basic_regex<>::assign [re.regex.assign] p16 say:

If no exception is thrown, flags() returns f and mark_count() returns the number of marked sub-expressions within the expression.

The default expectation in the library is that post-conditions only hold, if there is no failure (see also 2136), therefore the initial condition should be removed to prevent any misunderstanding.

History
Date User Action Args
2015-05-22 19:00:31adminsetmessages: + msg7425
2012-10-16 15:35:12adminsetmessages: + msg6169
2012-10-16 15:35:12adminsetstatus: new -> open
2012-03-12 20:11:34adminsetmessages: + msg6055
2012-03-08 00:00:00admincreate