add tests that debug mode catches nullptr->string_view conversions in comparison operators

llvm-svn: 372907
This commit is contained in:
Eric Fiselier 2019-09-25 18:43:40 +00:00
parent d3b2b97195
commit a32717750d
1 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,11 @@ void test_null_argument() {
EXPECT_DEATH(std::string_view(nullptr));
EXPECT_DEATH(std::string_view(NULL));
EXPECT_DEATH(std::string_view(static_cast<const char*>(0)));
{
std::string_view v;
EXPECT_DEATH(((void)(v == nullptr)));
EXPECT_DEATH(((void)(nullptr == v)));
}
}
int main(int, char**)