[LLVMbugs] [Bug 21597] New: Any regular expression should not match an empty sequence if match_not_null is specified

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 18 10:50:30 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21597

            Bug ID: 21597
           Summary: Any regular expression should not match an empty
                    sequence if match_not_null is specified
           Product: libc++
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kariya_mitsuru at hotmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 13364
  --> http://llvm.org/bugs/attachment.cgi?id=13364&action=edit
clang++ -v

The sample code below should output "not match" but it outputs "match:0, 0" if
it is compiled by clang 3.6.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/TPxMmBQOGj7FsFMZ

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/v1HhsIs8d2LrmUk9
(Sorry, It is compiled by gcc for restriction of Wandbox.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141118/6ceca256/attachment.html>


More information about the llvm-bugs mailing list