Title
Inconsistent default argument for basic_regex<>::assign
Status
c++20
Section
[re.regex]
Submitter
Mark de Wever

Created on 2019-09-16.00:00:00 last changed 46 months ago

Messages

Date: 2019-10-31.18:49:00

Proposed resolution:

This wording is relative to N4830.

  1. Modify [re.regex], class template basic_regex synopsis, as indicated:

    […]
    // [re.regex.assign], assign
    […]
    basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
    basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
    template<class string_traits, class A>
      basic_regex& assign(const basic_string<charT, string_traits, A>& s,
                          flag_type f = regex_constants::ECMAScript);
    template<class InputIterator>
      basic_regex& assign(InputIterator first, InputIterator last,
                          flag_type f = regex_constants::ECMAScript);
    basic_regex& assign(initializer_list<charT>,
                        flag_type = regex_constants::ECMAScript);
    […]
    
Date: 2019-10-31.00:00:00

[ 2019-10-31 Issue Prioritization ]

Status to Tentatively Ready and priority to 0 after six positive votes on the reflector.

Date: 2019-09-24.19:30:49

The declaration of the overload of basic_regex<>::assign(const charT* p, size_t len, flag_type f) has an inconsistent default argument for the flag_type f parameter.

[re.regex] p3:

basic_regex& assign(const charT* p, size_t len, flag_type f);

[re.regex.assign] before p12:

basic_regex& assign(const charT* ptr, size_t len, flag_type f = regex_constants::ECMAScript);

Since all other overloads have a default argument in both [re.regex] and [re.regex.assign] I propose to add a default argument for this overload in the declaration in [re.regex].

It should be pointed out that there exists implementation divergence due to the current wording state: libc++ and libstdc++ do not implement the default argument. The MS STL library does have the default argument.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: voting -> wp
2020-01-17 04:54:50adminsetstatus: ready -> voting
2019-10-31 18:49:00adminsetmessages: + msg10714
2019-10-31 18:49:00adminsetstatus: new -> ready
2019-09-22 17:54:30adminsetmessages: + msg10662
2019-09-16 00:00:00admincreate