unbreak fbstring<wchar_t> default constructor (!!!)
authorTudor Bosman <tudorb@fb.com>
Tue, 18 Dec 2012 03:00:40 +0000 (19:00 -0800)
committerJordan DeLong <jdelong@fb.com>
Sat, 19 Jan 2013 00:37:28 +0000 (16:37 -0800)
Test Plan: folly/test/fbstring_test in debug mode

Reviewed By: sdoroshenko@fb.com

FB internal diff: D661622

folly/FBString.h
folly/test/FBStringTest.cpp

index bf8a9807c3a2fe3ce507cd0db1068a3317d0ecf7..931c4c3b8760fc6e6782d55680b9991df26f1c21 100644 (file)
@@ -274,7 +274,7 @@ public:
   fbstring_core() {
     // Only initialize the tag, will set the MSBs (i.e. the small
     // string size) to zero too
-    ml_.capacity_ = maxSmallSize << (8 * (sizeof(size_t) - 1));
+    ml_.capacity_ = maxSmallSize << (8 * (sizeof(size_t) - sizeof(Char)));
     // or: setSmallSize(0);
     writeTerminator();
     assert(category() == isSmall && size() == 0);
index bd13a669441b1c6ad01add74e642f41070e1eeb4..a4948ce1681482a48da598df7b93ae10c6637dcc 100644 (file)
@@ -993,6 +993,11 @@ TEST(FBString, testFixedBugs) {
       cp += "bb";
     }
   }
+  {
+    // D661622
+    basic_fbstring<wchar_t> s;
+    EXPECT_EQ(0, s.size());
+  }
 }