From e01c7b1648dbbb76966b3bd4437bcf7699e77c35 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 15 May 2019 00:52:17 -0700 Subject: [PATCH] Move OffsetTo operator+ back out of class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently there's different overload resolution rules that apply, at least with some (older?) version of gcc. hb-ot-name-table.hh: In member function ‘void OT::name::accelerator_t::init(hb_face_t*)’: hb-ot-name-table.hh:244:62: error: ambiguous overload for ‘operator+’ (operand types are ‘hb_blob_ptr_t’ and ‘OT::NNOffsetTo > > {aka const OT::OffsetTo >, OT::IntType, false>}’) this->pool = (const char *) (const void *) (this->table+this->table->stringOffset); ^ hb-ot-name-table.hh:244:62: note: candidates are: hb-ot-name-table.hh:244:62: note: operator+(const C*, long int) hb-ot-name-table.hh:244:62: note: operator+(const char*, long int) --- src/hb-open-type.hh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index fcf1047b9..c150fe2a3 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -279,15 +279,6 @@ struct OffsetTo : Offset return StructAtOffset (base, *this); } - template - friend const Type& operator + (const Base *base, const OffsetTo &offset) { return offset (base); } - template - friend const Type& operator + (const OffsetTo &offset, const Base *base) { return offset (base); } - template - friend Type& operator + (Base *base, OffsetTo &offset) { return offset (base); } - template - friend Type& operator + (OffsetTo &offset, Base *base) { return offset (base); } - Type& serialize (hb_serialize_context_t *c, const void *base) { return * (Type *) Offset::serialize (c, base); @@ -366,6 +357,15 @@ using NNOffsetTo = OffsetTo; template using LNNOffsetTo = LOffsetTo; +template +static inline const Type& operator + (const Base *base, const OffsetTo &offset) { return offset (base); } +template +static inline const Type& operator + (const OffsetTo &offset, const Base *base) { return offset (base); } +template +static inline Type& operator + (Base *base, OffsetTo &offset) { return offset (base); } +template +static inline Type& operator + (OffsetTo &offset, Base *base) { return offset (base); } + /* * Array Types