From 967741e4c468ebf0a40f91934ed1923506099806 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 28 Aug 2018 18:18:02 -0700 Subject: [PATCH] Add explicit to hb_auto_t 1param constructors --- src/hb-dsalgs.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 8c910748b..7e06ff170 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -497,9 +497,10 @@ struct hb_auto_t : Type * * Apparently if we template for all types, then gcc seems to * capture a reference argument in the type, but clang doesn't, - * causing unwanted copies and bugs that come with it. */ - template hb_auto_t (T1 *t1) { Type::init (t1); } - template hb_auto_t (T1 &t1) { Type::init (t1); } + * causing unwanted copies and bugs that come with it. Ideally + * we should use C++11-style rvalue reference &&t1. */ + template explicit hb_auto_t (T1 *t1) { Type::init (t1); } + template explicit hb_auto_t (T1 &t1) { Type::init (t1); } ~hb_auto_t (void) { Type::fini (); } private: /* Hide */ void init (void) {}