FBString: fix constructors so it compiles with newer Clang's
Summary: Using Clang 3.7, this minimal test program: #include <folly/FBString.h> struct S { folly::basic_fbstring<char> x; }; int main(int argc, char *argv[]) { S s {}; return 0; } ... breaks with the following error output: FBStringTest.cpp:5:8: error: chosen constructor is explicit in copy-initialization S s {}; ^ ./folly/FBString.h:1009:12: note: constructor declared here explicit basic_fbstring(const A& = A()) noexcept { ^ FBStringTest.cpp:3:40: note: in implicit initialization of field 'x' with omitted initializer struct S { folly::basic_fbstring<char> x; }; ... because this `basic_fbstring` is used in a struct and the struct is being default-constructed. This patch splits the (nevertheless-correct) one-default-arg constructor into two, to deconfuse clang and have it select the correct constructor to avoid this issue. Reviewed By: matbd Differential Revision: D2632953 fb-gh-sync-id: 2c75ae85732678c31543f5cccc73d58317982f07
Showing
Please register or sign in to comment