harfbuzz icon indicating copy to clipboard operation
harfbuzz copied to clipboard

error: invalid operands to binary expression

Open ryandesign opened this issue 2 years ago • 1 comments

harfbuzz 8.1.1 fails to build with Apple clang versions earlier than 700:

In file included from main.cc:350:
In file included from ./hb-static.cc:29:
In file included from ./hb-open-type.hh:37:
In file included from ./hb-subset.hh:36:
In file included from ./hb-serialize.hh:36:
./hb-map.hh:402:5: error: invalid operands to binary expression ('hb_filter_iter_t<hb_array_t<hb_hashmap_t<unsigned int, unsigned int, true>::item_t>, bool (hb_hashmap_t<unsigned int, unsigned int, true>::item_t::*)() const, <anonymous struct at ./hb-algs.hh:224:1> &, nullptr>' and 'hb_map_iter_factory_t<hb_pair_t<const unsigned int &, unsigned int &> (hb_hashmap_t<unsigned int, unsigned int, true>::item_t::*)(), hb_function_sortedness_t::NOT_SORTED>')
    | hb_map (&item_t::get_pair_ref)
    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./hb-meta.hh:76:41: note: expanded from macro 'HB_AUTO_RETURN'
#define HB_AUTO_RETURN(E) -> decltype ((E)) { return (E); }
                                        ^
./hb-map.hh:520:19: note: in instantiation of template class 'hb_hashmap_t<unsigned int, unsigned int, true>' requested here
struct hb_map_t : hb_hashmap_t<hb_codepoint_t,
                  ^
./hb-buffer.hh:41:1: note: candidate function not viable: no known conversion from 'hb_filter_iter_t<hb_array_t<hb_hashmap_t<unsigned int, unsigned int, true>::item_t>, bool (hb_hashmap_t<unsigned int, unsigned int, true>::item_t::*)() const, <anonymous struct at ./hb-algs.hh:224:1> &, nullptr>' to 'hb_glyph_flags_t' for 1st argument
HB_MARK_AS_FLAG_T (hb_glyph_flags_t);
^
./hb-algs.hh:59:30: note: expanded from macro 'HB_MARK_AS_FLAG_T'
          static inline constexpr T operator | (T l, T r) { return T ((unsigned) l | (unsigned) r); } \
                                    ^
./hb-buffer.hh:42:1: note: candidate function not viable: no known conversion from 'hb_filter_iter_t<hb_array_t<hb_hashmap_t<unsigned int, unsigned int, true>::item_t>, bool (hb_hashmap_t<unsigned int, unsigned int, true>::item_t::*)() const, <anonymous struct at ./hb-algs.hh:224:1> &, nullptr>' to 'hb_buffer_flags_t' for 1st argument
HB_MARK_AS_FLAG_T (hb_buffer_flags_t);
^
./hb-algs.hh:59:30: note: expanded from macro 'HB_MARK_AS_FLAG_T'
          static inline constexpr T operator | (T l, T r) { return T ((unsigned) l | (unsigned) r); } \
                                    ^
./hb-buffer.hh:43:1: note: candidate function not viable: no known conversion from 'hb_filter_iter_t<hb_array_t<hb_hashmap_t<unsigned int, unsigned int, true>::item_t>, bool (hb_hashmap_t<unsigned int, unsigned int, true>::item_t::*)() const, <anonymous struct at ./hb-algs.hh:224:1> &, nullptr>' to 'hb_buffer_serialize_flags_t' for 1st argument
HB_MARK_AS_FLAG_T (hb_buffer_serialize_flags_t);
^
./hb-algs.hh:59:30: note: expanded from macro 'HB_MARK_AS_FLAG_T'
          static inline constexpr T operator | (T l, T r) { return T ((unsigned) l | (unsigned) r); } \
                                    ^

Full build log: harfbuzz-clang-600.log.gz

This was previously reported in https://github.com/harfbuzz/harfbuzz/issues/1651#issuecomment-484051395 where it was requested that a new issue be filed so here it finally is.

ryandesign avatar Aug 10 '23 06:08 ryandesign

FWIW the main problem is this:

./hb-iter.hh:359:1: note: candidate template ignored: substitution failure [with Lhs = hb_filter_iter_t<hb_array_t<hb_hashmap_t<const hb_serialize_context_t::object_t *, unsigned int, false>::item_t>, bool (hb_hashmap_t<const hb_serialize_context_t::object_t *, unsigned int, false>::item_t::*)() const, <anonymous struct at ./hb-algs.hh:224:1> &, nullptr>, Rhs = hb_map_iter_factory_t<hb_pair_t<const hb_serialize_context_t::object_t *, unsigned int> (hb_hashmap_t<const hb_serialize_context_t::object_t *, unsigned int, false>::item_t::*)() const, 0>]: no type named 'type' in 'hb_enable_if<false, void>'
operator | (Lhs&& lhs, Rhs&& rhs) HB_AUTO_RETURN (std::forward<Rhs> (rhs) (std::forward<Lhs> (lhs)))

I have no idea why hb_is_iterator (Iter) is failing on that filter/map pipeline.

I'm out of ideas on how to debug this, short of getting access to that compiler somehow. Which sounds hard given that I don't have an old Mac.

behdad avatar Aug 14 '23 17:08 behdad