Add tests for regex_match ambiguity (aka LWG2273). NFC. Reviewed as https://reviews.llvm.org/D63051

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365080 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow 2019-07-03 20:32:35 +00:00
parent 78af2bfb2f
commit 7d00fc23cd
3 changed files with 50 additions and 2 deletions

View File

@ -1367,6 +1367,30 @@ int main(int, char**)
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
{ // LWG 2273
std::regex re("Foo|FooBar");
std::cmatch m;
{
assert(std::regex_match("FooBar", m, re));
assert(m.size() == 1);
assert(m[0] == "FooBar");
}
{
assert(std::regex_match("Foo", m, re));
assert(m.size() == 1);
assert(m[0] == "Foo");
}
{
assert(!std::regex_match("FooBarBaz", m, re));
assert(m.size() == 0);
assert(m.empty());
}
{
assert(!std::regex_match("FooBa", m, re));
assert(m.size() == 0);
assert(m.empty());
}
}
return 0;
}

View File

@ -1547,6 +1547,30 @@ int main(int, char**)
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
{ // LWG 2273
std::regex re("Foo|FooBar");
std::cmatch m;
{
assert(std::regex_search("FooBar", m, re));
assert(m.size() == 1);
assert(m[0] == "Foo");
}
{
assert(std::regex_search("Foo", m, re));
assert(m.size() == 1);
assert(m[0] == "Foo");
}
{
assert(std::regex_search("FooBarBaz", m, re));
assert(m.size() == 1);
assert(m[0] == "Foo");
}
{
assert(std::regex_search("FooBa", m, re));
assert(m.size() == 1);
assert(m[0] == "Foo");
}
}
return 0;
}

View File

@ -257,7 +257,7 @@
<tr><td><a href="https://wg21.link/LWG2244">2244</a></td><td>Issue on <tt>basic_istream::seekg</tt></td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2250">2250</a></td><td>Follow-up On Library Issue 2207</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2259">2259</a></td><td>Issues in 17.6.5.5 rules for member functions</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2273">2273</a></td><td><tt>regex_match</tt> ambiguity</td><td>Kona</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG2273">2273</a></td><td><tt>regex_match</tt> ambiguity</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2336">2336</a></td><td><tt>is_trivially_constructible/is_trivially_assignable</tt> traits are always false</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2353">2353</a></td><td><tt>std::next</tt> is over-constrained</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2367">2367</a></td><td><tt>pair</tt> and <tt>tuple</tt> are not correctly implemented for <tt>is_constructible</tt> with no args</td><td>Kona</td><td>Complete</td></tr>
@ -503,7 +503,7 @@
<!-- <tr><td></td><td></td><td></td><td></td></tr> -->
</table>
<p>Last Updated: 26-Feb-2018</p>
<p>Last Updated: 3-Jul-2019</p>
</div>
</body>
</html>