Skip to content

Commit

Permalink
add tests that debug mode catches nullptr->string_view conversions in…
Browse files Browse the repository at this point in the history
… comparison operators

llvm-svn: 372907
  • Loading branch information
EricWF committed Sep 25, 2019
1 parent d3b2b97 commit a327177
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libcxx/test/libcxx/debug/db_string_view.pass.cpp
Expand Up @@ -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**)
Expand Down

0 comments on commit a327177

Please sign in to comment.