[Bug libstdc++/63920] New: Any regular expression should not match an empty sequence if match_not_null is specified
kariya_mitsuru at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Nov 17 17:49:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63920
Bug ID: 63920
Summary: Any regular expression should not match an empty
sequence if match_not_null is specified
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: kariya_mitsuru at hotmail dot com
Created attachment 34005
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34005&action=edit
gcc -v
The sample code below should output "not match" but it outputs "match:1, 0" if
it is compiled by gcc 5.0.
====================================================================================================
#include <iostream>
#include <regex>
int main()
{
std::cmatch m;
auto result = std::regex_search("a", m, std::regex("b*"),
std::regex_constants::match_not_null);
if (result) {
std::cout << "match:" << m.position() << ", " << m.length() <<
std::endl;
} else {
std::cout << "not match" << std::endl;
}
}
====================================================================================================
cf. http://melpon.org/wandbox/permlink/pTz5CBMMP4a6BU7f
According to C++11 standard 28.5.2[re.matchflag]/Table 139, "The expression
shall not match an empty sequence." if match_not_null is specified.
Note that the sample code of the Boost.regex version outputs "not match".
cf. http://melpon.org/wandbox/permlink/mfFqERCbt6qFf8HC
More information about the Gcc-bugs
mailing list