summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/re
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2016-02-11 15:23:04 +0000
committerMarshall Clow <mclow.lists@gmail.com>2016-02-11 15:23:04 +0000
commit9b66ab75fde5c2f451c36621e15b2489ee71c00c (patch)
tree7a31b0866d27b981c470e643824804bafa5c7217 /libcxx/test/std/re
parent8e39768c21af7918a732ce15f62f2b62623196c0 (diff)
downloadbcm5719-llvm-9b66ab75fde5c2f451c36621e15b2489ee71c00c.tar.gz
bcm5719-llvm-9b66ab75fde5c2f451c36621e15b2489ee71c00c.zip
Add some tests to ensure that the __regex_word does not conflict with any of ctype_base's values.
Hopefully this will catch cases like https://llvm.org/bugs/show_bug.cgi?id=26476 in the future. llvm-svn: 260527
Diffstat (limited to 'libcxx/test/std/re')
-rw-r--r--libcxx/test/std/re/re.traits/lookup_classname.pass.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libcxx/test/std/re/re.traits/lookup_classname.pass.cpp b/libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
index 0b1b18eb507..d3e5a5caa21 100644
--- a/libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
+++ b/libcxx/test/std/re/re.traits/lookup_classname.pass.cpp
@@ -33,6 +33,19 @@ test(const char_type* A,
int main()
{
+// if __regex_word is not distinct from all the classes, bad things happen
+// See https://llvm.org/bugs/show_bug.cgi?id=26476 for an example.
+ assert((std::ctype_base::space & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::print & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::cntrl & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::upper & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::lower & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::alpha & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::digit & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::punct & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::xdigit & std::regex_traits<char>::__regex_word) == 0);
+ assert((std::ctype_base::blank & std::regex_traits<char>::__regex_word) == 0);
+
test("d", std::ctype_base::digit);
test("D", std::ctype_base::digit);
test("d", std::ctype_base::digit, true);
OpenPOWER on IntegriCloud