From 250d88925081930627eb9fb6d2ab9ebea47e185c Mon Sep 17 00:00:00 2001 From: Hannes Friederich Date: Tue, 5 Apr 2022 12:12:56 -0700 Subject: [PATCH] fixes to support -Wstring-conversion compiler warning Summary: We're in the process of enable `-Wstring-conversion` in the default arvr build modes. The reason is that it flags legitimate bugs such as D35316465. Reviewed By: mhorowitz Differential Revision: D35389996 fbshipit-source-id: 20fdb00f0b630a723d5a253fd80257edfa87bafb --- cxx/fbjni/detail/SimpleFixedString.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cxx/fbjni/detail/SimpleFixedString.h b/cxx/fbjni/detail/SimpleFixedString.h index 4d50d9b..1a6fa9a 100644 --- a/cxx/fbjni/detail/SimpleFixedString.h +++ b/cxx/fbjni/detail/SimpleFixedString.h @@ -75,7 +75,7 @@ namespace fixedstring { // it's testing for fails. In this way, precondition violations are reported // at compile-time instead of at runtime. [[noreturn]] inline void assertOutOfBounds() { - assert(!"Array index out of bounds in SimpleFixedString"); + assert(!(bool)"Array index out of bounds in SimpleFixedString"); throw std::out_of_range( "Array index out of bounds in SimpleFixedString"); } @@ -92,7 +92,7 @@ constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max) { // Intentionally NOT constexpr. See note above for assertOutOfBounds [[noreturn]] inline void assertNotNullTerminated() noexcept { - assert(!"Non-null terminated string used to initialize a SimpleFixedString"); + assert(!(bool)"Non-null terminated string used to initialize a SimpleFixedString"); std::terminate(); // Fail hard, fail fast. }