This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
incorrect semantics of 'using'
- From: Alexey Starovoytov <Alexey dot Starovoytov at Sun dot COM>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 15 Aug 2006 16:36:35 -0700 (PDT)
- Subject: 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.