https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83598
Bug ID: 83598 Summary: std::basic_regex C++14 conformance issue: resulting flags != passed flags Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: andrey.y.guskov at intel dot com Target Milestone: --- C++14 standard (page 1114, see here: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf#1128) says: explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript); Requires: p shall not be a null pointer. Throws: regex_error if p is not a valid regular expression. Effects: Constructs an object of class basic_regex; the object’s internal finite state machine is constructed from the regular expression contained in the array of charT of length char_traits<charT>::length(p) whose first element is designated by p, and interpreted according to the flags f. Postconditions: flags() returns f. mark_count() returns the number of marked sub-expressions within the expression. ... As of now, std::basic_regex implementation disagrees with the standard in that the flags set upon construction aren`t equal to the flags passed to the constructor. Reproducer: #include <regex> int main() { std::basic_regex<char> ca("(a)(b)", std::regex_constants::icase); std::basic_regex<char> cb("(a)(b)", std::regex_constants::nosubs); std::basic_regex<wchar_t> wa(L"(a)(b)", std::regex_constants::icase); std::basic_regex<wchar_t> wb(L"(a)(b)", std::regex_constants::nosubs); printf(((ca.flags() == std::regex_constants::icase) || (cb.flags() == std::regex_constants::nosubs) || (wa.flags() == std::regex_constants::icase) || (wb.flags() == std::regex_constants::nosubs))? "PASS\n" : "FAIL\n"); return 0; }