[gnu.g++.bug] bug in g++ 1.35.0 -- no fix

becher@argosy.UUCP (Jonathan D. Becher) (08/29/89)

We brought up g++ 1.35.0 last week and ran into a series of problems.
The only one I wasn't able to work around is the following:

The following code incorrectly, I believe, calls the derived method
instead of the base class method.  Is this still a problem in newer
versions?  What can I do for a fix?

g++ version 1.35.0
  /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dvax -Dunix -D__vax__ -D__unix__ t.cc /tmp/cca04568.cpp
GNU CPP version 1.35
  /usr/local/lib/gcc-cc1plus /tmp/cca04568.cpp -quiet -dumpbase t.cc -noreg -version -o /tmp/cca04568.s
GNU C++ version 1.35.0 (vax) compiled by GNU C version 1.34.
  as /tmp/cca04568.s -o t.o
  /usr/local/lib/gcc-ld++ -C /usr/local/lib/crt0+.o t.o -lg++ /usr/local/lib/gcc-gnulib -lc

class parent {
public:
    int foo() { printf("parent\n"); }
};

class child : public parent {
public:
    int foo() { printf("child\n"); }
};

main()
{
    child bar;

    int i = bar.parent::foo();
}


Jon Becher
argosy!becher@decwrl.dec.com
"Why is live, evil spelled backwards?"

schmidt@zola.ics.uci.edu (Doug Schmidt) (08/29/89)

In article <235@argosy.UUCP>, becher@argosy (Jonathan D. Becher) writes:
>We brought up g++ 1.35.0 last week and ran into a series of problems.
>The only one I wasn't able to work around is the following:
>
>The following code incorrectly, I believe, calls the derived method
>instead of the base class method.  Is this still a problem in newer
>versions?  What can I do for a fix?
>class parent {
>public:
>    int foo() { printf("parent\n"); }
>};
>
>class child : public parent {
>public:
>    int foo() { printf("child\n"); }
>};
>
>main()
>{
>    child bar;
>
>    int i = bar.parent::foo();
>}

My version of g++ (a beta 1.36 based upon gcc-1.35.97) prints

parent

I assume this means the bug is fixed?!

Doug
--
schmidt@ics.uci.edu (ARPA) |   Per me si va nella citta' dolente.
office: (714) 856-4043     |   Per me si va nell'eterno dolore.
                           |   Per me si va tra la perduta gente.
                           |   Lasciate ogni speranza o voi ch'entrate.