This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

incorrect semantics of 'using'


Hi,

for the following test case:
struct A {
  virtual int x () {return 1;}
};

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

struct C: B{
   using A::x;
};

int main()
{
  C c;
  return c.x();
}

all g++ 4.x will return 1
It seems C++ standard would want to see 0.
Using-declaration introduces the virtual method x() in the class C and
it's supposed to stay 'virtual', whereas g++ seems to treat it as it overrides
the B's method. In other words using-declaration should effectively be
ignored in this case.

Alex.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]