From 3bc86fb237b668e738a78397be04c603e7cf083b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 30 Aug 2019 16:39:52 -0500 Subject: [PATCH] [algs] Fix hb_inc/dec signature --- src/hb-algs.hh | 5 +++-- src/test-algs.cc | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 78b86f37a..6b74a2532 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -82,6 +82,7 @@ HB_FUNCOBJ (hb_bool); struct { private: + template constexpr auto impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, hb_deref (v).hash ()) @@ -997,13 +998,13 @@ HB_FUNCOBJ (hb_neg); struct { template constexpr auto - operator () (const T &a) const HB_AUTO_RETURN (++a) + operator () (T &a) const HB_AUTO_RETURN (++a) } HB_FUNCOBJ (hb_inc); struct { template constexpr auto - operator () (const T &a) const HB_AUTO_RETURN (--a) + operator () (T &a) const HB_AUTO_RETURN (--a) } HB_FUNCOBJ (hb_dec); diff --git a/src/test-algs.cc b/src/test-algs.cc index 333a89242..f8b8ff666 100644 --- a/src/test-algs.cc +++ b/src/test-algs.cc @@ -87,5 +87,9 @@ main (int argc, char **argv) assert (hb_add (2) (5) == 7); assert (hb_add (5) (2) == 7); + x = 1; + assert (++hb_inc (x) == 3); + assert (x == 3); + return 0; }