[HarfBuzz] 'CoverageFormat1::Iter' cannot access private struct declared in class 'CoverageFormat1'

Jonathan Kew jfkthame at googlemail.com
Sun Sep 16 08:51:02 PDT 2012


On 16/9/12 02:15, Behdad Esfahbod wrote:
> On 09/13/2012 07:32 AM, Samiullah Khawaja wrote:
>> Hi,
>>
>> I am trying to build hurfbuzz 0.9.3 in Visual Studio 2005. It gives me
>> following error in file: hb-ot-layout-common-private.h on line: 561
>>
>> 'CoverageFormat1::Iter' cannot access private struct declared in class
>> 'CoverageFormat1'.
>>
>> I did some investigation and found that the Iter is declared private in the
>> CoverageFormat1 struct and thus the compiler error occurs.
>
> Humm.  This sounds like a difference in how "friend" handling works in VS
> 2005.  I'm leaning towards not having to support such an old compiler.  I
> tried adding additional friend declarations to help resolve this but adding
> "friend Coverage::Iter" before Coverage itself is fully defined doesn't seem
> to work, so I'm out of ideas for a simple fix short of making the Iter's
> public.  That's probably not a big deal, but diverts from the current design
> of HarfBuzz.

If you're willing to clutter the code a bit for the sake of 
compatibility, you could do something like

#if defined(_MSC_VER) && (_MSC_VER < 1500) /* pre-2008 visual studio */
#define HB_PRIVATE_UNLESS_OLD_MSVC public
#else
#define HB_PRIVATE_UNLESS_OLD_MSVC private
#endif

and then mark the relevant Iter declarations with 
"HB_PRIVATE_UNLESS_OLD_MSVC:".

That would avoid making the Iter public for other builds, so that modern 
compilers will still be checking that nobody else tries to use it.

JK




More information about the HarfBuzz mailing list