diff --git a/src/hb-iter-private.hh b/src/hb-iter-private.hh index 410a50f94..314133ade 100644 --- a/src/hb-iter-private.hh +++ b/src/hb-iter-private.hh @@ -72,7 +72,7 @@ struct Iter array (array_), length (length_) {} /* Emptiness. */ - inline operator bool (void) const { return bool (length); } + explicit_operator inline operator bool (void) const { return bool (length); } /* Current item. */ inline T &operator * (void) diff --git a/src/hb-private.hh b/src/hb-private.hh index 1bc996edb..efe7bda9e 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -125,7 +125,20 @@ struct _hb_alignof #define alignof(x) (_hb_alignof::value) #endif -#endif // __cplusplus < 201103L +/* https://github.com/harfbuzz/harfbuzz/issues/1127 */ +#ifndef explicit_operator +#define explicit_operator +#endif + +#else /* __cplusplus >= 201103L */ + +/* https://github.com/harfbuzz/harfbuzz/issues/1127 */ +#ifndef explicit_operator +#define explicit_operator explicit +#endif + +#endif /* __cplusplus < 201103L */ + #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__) #define likely(expr) (__builtin_expect (!!(expr), 1))