<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Any regular expression should not match an empty sequence if match_not_null is specified"
   href="http://llvm.org/bugs/show_bug.cgi?id=21597">21597</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Any regular expression should not match an empty sequence if match_not_null is specified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kariya_mitsuru@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13364" name="attach_13364" title="clang++ -v">attachment 13364</a> <a href="attachment.cgi?id=13364&action=edit" title="clang++ -v">[details]</a></span>
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. <a href="http://melpon.org/wandbox/permlink/TPxMmBQOGj7FsFMZ">http://melpon.org/wandbox/permlink/TPxMmBQOGj7FsFMZ</a>

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. <a href="http://melpon.org/wandbox/permlink/v1HhsIs8d2LrmUk9">http://melpon.org/wandbox/permlink/v1HhsIs8d2LrmUk9</a>
(Sorry, It is compiled by gcc for restriction of Wandbox.)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>