G++ switch to make everything public in a class?

Ian Lance Taylor iant@google.com
Mon Aug 1 01:42:00 GMT 2011


Jeffrey Walton <noloader@gmail.com> writes:

> On Sun, Jul 31, 2011 at 2:40 PM, Ian Lance Taylor <iant@google.com> wrote:
>> Jeffrey Walton <noloader@gmail.com> writes:
>>
>>> Is there a switch to force everything public?
>>
>> -Dprivate=public -Dprotected=public
>>
>>> If not, how does one
>>> typically access the non-public stuff for testing?
>>
>> There are a variety of techniques, but this is really a general C++
>> question, not a gcc question.  E.g., search for "c++ testing private
>> methods".
> Thanks Ian. But I'm not clear on why a g++ switch is not gcc help
> related. GCC does have other visibility related switches (eg,
> -Wctor-dtor-privacy).

Oh, sure, the question about a g++ option is certainly appropriate for
gcc-help, and I answered that part of the question.  Using -D options as
I proposed would be equivalent to any option specifically for this
feature, and in fact there is no other option.

Ian



More information about the Gcc-help mailing list