Fix -Wstring-plus-int in FixedStringTest.cpp (#1148)
Summary: - Clang 8 warns about appending integers to a string using `operator+` without a cast. ``` ../folly/test/FixedStringTest.cpp:353:23: warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int] a.append("X world!" + 2u, 5u); ~~~~~~~~~~~^~~~ ../folly/test/FixedStringTest.cpp:353:23: note: use array indexing to silence this warning a.append("X world!" + 2u, 5u); ^ & [ ] ../folly/test/FixedStringTest.cpp:354:23: warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int] a.append("X world!" + 7u); ~~~~~~~~~~~^~~~ ../folly/test/FixedStringTest.cpp:354:23: note: use array indexing to silence this warning a.append("X world!" + 7u); ^ & [ ] ../folly/test/FixedStringTest.cpp:365:23: warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int] a.append("X world!" + 2u, 5u); ~~~~~~~~~~~^~~~ ../folly/test/FixedStringTest.cpp:365:23: note: use array indexing to silence this warning a.append("X world!" + 2u, 5u); ^ & [ ] ../folly/test/FixedStringTest.cpp:366:23: warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int] a.append("X world!" + 7u); ~~~~~~~~~~~^~~~ ../folly/test/FixedStringTest.cpp:366:23: note: use array indexing to silence this warning a.append("X world!" + 7u); ^ & [ ] ``` - Fix this warning by creating a local char[] and using that to append to the fixed string Pull Request resolved: https://github.com/facebook/folly/pull/1148 Reviewed By: ericniebler Differential Revision: D15618465 Pulled By: yfeldblum fbshipit-source-id: 7f72b3597f51d99665da85744aeb8805eb2e8f00
Showing
Please register or sign in to comment