Created on 2000-11-02.00:00:00 last changed 196 months ago
[Voted into WP at April 2003 meeting.]
Proposed resolution (04/02):
In 9.9 [namespace.udecl] paragraph 12 change:
When a using-declaration brings names from a base class into a derived class scope, member functions in the derived class override and/or hide member functions with the same name and parameter types in a base class (rather than conflicting).to read:
When a using-declaration brings names from a base class into a derived class scope, member functions and member function templates in the derived class override and/or hide member functions and member function templates with the same name, parameter-type-list (9.3.4.6 [dcl.fct]), and cv-qualification in a base class (rather than conflicting).
In 11.7.3 [class.virtual] paragraph 2 change:
If a virtual member function vf is declared in a class Base and in a class Derived, derived directly or indirectly from Base, a member function vf with the same name and same parameter list as Base::vf is declared, then Derived::vf is also virtual (whether or not it is so declared) and it overrides Base::vf.to read:
If a virtual member function vf is declared in a class Base and in a class Derived, derived directly or indirectly from Base, a member function vf with the same name, parameter-type-list (9.3.4.6 [dcl.fct]), and cv-qualification as Base::vf is declared, then Derived::vf is also virtual (whether or not it is so declared) and it overrides Base::vf.
See issue 140 for the definition of parameter-type-list.
Notes on the 04/01 meeting:
The hiding and overriding should be on the basis of the function signature, which includes any cv-qualification on the function.
According to 9.9 [namespace.udecl] paragraph 12,
When a using-declaration brings names from a base class into a derived class scope, member functions in the derived class override and/or hide member functions with the same name and parameter types in a base class (rather than conflicting).
Note that this description says nothing about the cv-qualification of the hiding and hidden member functions. This means, for instance, that a non-const member function in the derived class hides a const member function with the same name and parameter types instead of overloading it in the derived class scope. For example,
struct A { virtual int f() const; virtual int f(); }; struct B: A { B(); int f(); using A::f; }; const B cb; int i = cb.f(); // ill-formed: A::f() const hidden in B
The same terminology is used in 11.7.3 [class.virtual] paragraph 2:
If a virtual member function vf is declared in a class Base and in a class Derived, derived directly or indirectly from Base, a member function vf with the same name and same parameter list as Base::vf is declared, then Derived::vf is also virtual (whether or not it is so declared) and it overrides Base::vf.
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
2003-04-25 00:00:00 | admin | set | messages: + msg863 |
2003-04-25 00:00:00 | admin | set | status: ready -> wp |
2002-11-08 00:00:00 | admin | set | status: review -> ready |
2001-11-09 00:00:00 | admin | set | messages: + msg552 |
2001-11-09 00:00:00 | admin | set | status: drafting -> review |
2001-05-20 00:00:00 | admin | set | messages: + msg493 |
2001-05-20 00:00:00 | admin | set | status: open -> drafting |
2000-11-02 00:00:00 | admin | create |