From 09836013995cab2b9f07577a179ad7b024130467 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 22 Feb 2021 22:33:17 -0700 Subject: [PATCH] Add back wider cast to IntType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit My local clang12 is fine, but many bots are not: ../src/hb-ot-cff1-table.hh: In instantiation of ‘bool CFF::Charset1_2::sanitize(hb_sanitize_context_t*, unsigned int) const [with TYPE = OT::IntType]’: ../src/hb-ot-cff1-table.hh:554:13: required from here ../src/hb-ot-cff1-table.hh:377:60: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if (unlikely (!ranges[i].sanitize (c) || (num_glyphs < ranges[i].nLeft + 1))) ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ Enabling the extra cast operator mentioned in previous commit to see if that fixes this case. Again, I'd be happy to say "use 1u instead of 1" if this was universally erred on. But since some compilers happily compile this while others err, it would be a huge headache. Let's see... https://github.com/harfbuzz/harfbuzz/pull/2875 --- src/hb-open-type.hh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 1af4e6e64..ff12d4af5 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -64,6 +64,11 @@ struct IntType IntType& operator = (Type i) { v = i; return *this; } operator Type () const { return v; } + template , + hb_enable_if (sizeof (Type) < sizeof (Type2))> + operator hb_type_identity_t () const { return v; } + + bool operator == (const IntType &o) const { return (Type) v == (Type) o.v; } bool operator != (const IntType &o) const { return !(*this == o); }