C++ inheritance question

Ian Lance Taylor iant@google.com
Fri Aug 21 16:32:00 GMT 2009


Tyler Earman <rem.intellegare@gmail.com> writes:

> I have a question regarding inheritance in C++ on GCC.  Now I've asked
> this question in the past but I'd like to expound on it a little so we
> can have a less hackish approach to this system.  I know GCC follows the
> C++98 standard very well and its the standard that's at fault for this
> little idiom, but I'd like to override it if possible.
>
> Basically when a class inherits another class, specifically with
> templates I believe, some of the methods within the first inherited
> class become unaccessible without the "this->" operator (or a "using"
> construct; the code is bellow).
>
> Now I know the better way of working this is to use multiple inheritance
> with virtual interfaces, but if possible I'd like to break the C++
> standard right here for a moment, and enable GCC to compile the code
> without complaining about this particular ABI.
>
> Is there a way to do this?  I don't think -fpermissive works, but would
> one of the older standards?

There is no way to do this, and it would probably not be a good idea,
for exactly the reasons that the C++ standards committee designed
two-phase name lookup in the first place.

Ian



More information about the Gcc-help mailing list