From 56d2d0294b836ea1e2dea9e242ae72c99387d00a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 7 May 2019 23:08:49 -0700 Subject: [PATCH] [algs] Sprinkle hb_min/max with hb-forward salad Let's see if fixes MSVC fail. Though, the error doesn't make sense to me. hb-blob.cc c:\projects\harfbuzz\src\hb-algs.hh(166): error C2440: 'return': cannot convert from 'unsigned int' to 'unsigned int &&' [C:\projects\harfbuzz\build\harfbuzz.vcxproj] c:\projects\harfbuzz\src\hb-algs.hh(166): note: You cannot bind an lvalue to an rvalue reference c:\projects\harfbuzz\src\hb-algs.hh(174): note: see reference to function template instantiation 'T &&::impl(T &&,T2) const' being compiled with [ T=unsigned int, T2=unsigned int & ] --- src/hb-algs.hh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 77382458..9e8a4aeb 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -163,11 +163,12 @@ struct { private: template auto - impl (T&& a, T2&& b) const HB_AUTO_RETURN (a <= b ? a : b) + impl (T&& a, T2&& b) const HB_AUTO_RETURN + (hb_forward (a) <= hb_forward (b) ? hb_forward (a) : hb_forward (b)) public: template auto - operator () (T&& a) const HB_AUTO_RETURN (a) + operator () (T&& a) const HB_AUTO_RETURN (hb_forward (a)) template auto operator () (T&& a, Ts&& ...ds) const HB_AUTO_RETURN @@ -178,11 +179,12 @@ struct { private: template auto - impl (T&& a, T2&& b) const HB_AUTO_RETURN (a >= b ? a : b) + impl (T&& a, T2&& b) const HB_AUTO_RETURN + (hb_forward (a) >= hb_forward (b) ? hb_forward (a) : hb_forward (b)) public: template auto - operator () (T&& a) const HB_AUTO_RETURN (a) + operator () (T&& a) const HB_AUTO_RETURN (hb_forward (a)) template auto operator () (T&& a, Ts&& ...ds) const HB_AUTO_RETURN -- GitLab