Bug 29136 - using declaration misinterpreted in classes
Summary: using declaration misinterpreted in classes
Status: RESOLVED DUPLICATE of bug 11750
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-19 09:26 UTC by Andrew Stubbs
Modified: 2006-09-19 09:41 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Stubbs 2006-09-19 09:26:25 UTC
The following program should return 1 when executed:

struct A {
  virtual int f() {return 1;}
};

struct B : virtual A {
  virtual int f() {return 0;}
};

struct C : B , virtual A {
  using A::f;
};

int
main () {
  C c;
  return c.f () + c.C::f ();
}

It actually returns 2.

The C++ standard section 10.3 shows the example which somewhat matches the code
above. The 'c.f()' is supposed to call 'B::f' and the 'c.C::f()' is supposed
to call 'A::f'. In fact, both call 'A::f'.
Comment 1 Andrew Pinski 2006-09-19 09:41:56 UTC
This is a dup of bug 11750, it was not hard to find that bug.
Anyways the problem here is that we still use mostly the old ARM style using semantics instead of the standard defined ones.

*** This bug has been marked as a duplicate of 11750 ***