I am trying to port the protocol buffer library to Green Hills Integrity on a PPC platform. When compiling the library, I ran into the following compiler error:
"..\vendor\protobuf\src\google/protobuf/reflection_internal.h", line 306: error #1001:
class member designated by a using-declaration must be visible in a
direct base class
using RepeatedFieldAccessor::Add;
Below is the code snippet where the error occured in reflection_internal.h:
class RepeatedPtrFieldStringAccessor : public RepeatedPtrFieldWrapper<string> {
typedef void Field;
typedef void Value;
using RepeatedFieldAccessor::Add;
public:
RepeatedPtrFieldStringAccessor() {}
};
It seems the statement "using RepeatedFieldAccessor::Add" is trying to access the member function Add() that is two levels higher in the class hierarchy, which is not allowed by the compiler because it is not a direct base class. If my explanation is confusing, I wrote a small snippet of code below that simulates the same problem:
class A
{
public:
virtual void foo() {}
};
template<typename T>
class B : public A
{
public:
virtual void foo() {}
};
class C : public B<std::string>
{
using A::foo;
};
I am to successfully compile the protobuf library using Microsoft Visual Studio and Linux GNUC, but not MULTI Integrity compiler. I consulted with Green Hills and they say that syntax is illegal. They even pointed me to this link:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
Does anyone know how to workaround this issue? I rather not have to modify the protobuf library code to fix it.
Thanks,
-Alex