Build error with -Werror=return-type
Got a build error with -Werror=return-type enabled
folly/folly/settings/Types.cpp: In function ‘std::string_view folly::settings::toString(folly::settings::SetErrorCode)’: folly/folly/settings/Types.cpp:31:1: error: control reaches end of non-void function [-Werror=return-type]
std::string_view folly::settings::toString(folly::settings::SetErrorCode error) { switch (error) { case SetErrorCode::kSuccess: return "kSuccess"; case SetErrorCode::kError: return "kError"; // add a program } // Default return (if program doesn't match) return "Unknown Error"; } Function of: toString(folly::settings::SetErrorCode) is expected to return a value of type std::string_view . Therefore, we need to ensure that all execution paths within the function return a value