folly: fbvector: ubsan: avoid memset(nullptr, 0, 0)
[folly.git] / folly / test / FBVectorTest.cpp
index 54f64efedeeed9996d39fdb3245d1b0734a8167a..e4bfe89b6b5bfc6ce7618f979f330886c0ffcae4 100644 (file)
@@ -268,3 +268,17 @@ TEST(FBVector, shrink_to_fit_after_clear) {
   EXPECT_EQ(fb1.size(), 0);
   EXPECT_EQ(fb1.capacity(), 0);
 }
+
+TEST(FBVector, zero_len) {
+  fbvector<int> fb1(0);
+  fbvector<int> fb2(0, 10);
+  fbvector<int> fb3(std::move(fb1));
+  fbvector<int> fb4;
+  fb4 = std::move(fb2);
+  fbvector<int> fb5 = fb3;
+  fbvector<int> fb6;
+  fb6 = fb4;
+  std::initializer_list<int> il = {};
+  fb6 = il;
+  fbvector<int> fb7(fb6.begin(), fb6.end());
+}