From ceda1f03b7b06248ffd056eb7b2400088bb4a121 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 9 May 2019 15:19:42 -0700 Subject: [PATCH] Fix compile NameRecord is not copy-constructible, so should be iterator of const-reference. --- src/hb-meta.hh | 2 -- src/hb-ot-name-table.hh | 2 +- src/test-meta.cc | 12 ++++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/hb-meta.hh b/src/hb-meta.hh index bcd541e..b906c55 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -157,8 +157,6 @@ struct hb_is_convertible (!either_void && decltype (impl> (hb_prioritize))::value); }; - - #define hb_is_convertible(From,To) hb_is_convertible::value diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 1c8f544..04995c4 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -170,7 +170,7 @@ struct name { return min_size + count * nameRecordZ.item_size; } template + hb_requires (hb_is_iterator_of (Iterator, const NameRecord &))> bool serialize (hb_serialize_context_t *c, Iterator it, const void *src_string_pool) diff --git a/src/test-meta.cc b/src/test-meta.cc index a7cfef5..d2976b6 100644 --- a/src/test-meta.cc +++ b/src/test-meta.cc @@ -55,6 +55,18 @@ main (int argc, char **argv) static_assert (hb_is_convertible (int&, const int)); static_assert (hb_is_convertible (const int&, int)); static_assert (hb_is_convertible (const int&, const int)); + static_assert (hb_is_convertible (const int&, const int)); + + struct X {}; + + static_assert (hb_is_convertible (const X &, const X)); + static_assert (hb_is_convertible (X &, const X)); + static_assert (hb_is_convertible (X &, const X &)); + static_assert (hb_is_convertible (X, const X &)); + static_assert (hb_is_convertible (const X, const X &)); + static_assert (!hb_is_convertible (const X, X &)); + static_assert (!hb_is_convertible (X, X &)); + static_assert (hb_is_convertible (X &, X &)); static_assert (hb_is_convertible (int&, long)); static_assert (!hb_is_convertible (int&, long&)); -- 2.7.4