Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


258.using-declarations and cv-qualifiers

Section:9.10  [namespace.udecl]    Status:CD1    Submitter:Liam Fitzpatrick    Date:2 Nov 2000

[Voted into WP at April 2003 meeting.]

According to 9.10 [namespace.udecl] paragraph 12,

When ausing-declaration brings names from a base class into aderived class scope, member functions in the derived class overrideand/or hide member functions with the same name and parameter types ina base class (rather than conflicting).

Note that this description says nothing about the cv-qualificationof the hiding and hidden member functions. This means, for instance,that a non-const member function in the derived class hides a constmember function with the same name and parameter types instead ofoverloading 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 functionvf is declared in a classBase and in a classDerived, derived directly orindirectly fromBase, a member functionvf with thesame name and same parameter list asBase::vf is declared,thenDerived::vf is also virtual (whether or not it is sodeclared) and it overridesBase::vf.

Notes on the 04/01 meeting:

The hiding and overriding shouldbe on the basis of the function signature, which includes anycv-qualification on the function.

Proposed resolution (04/02):

In 9.10 [namespace.udecl] paragraph 12 change:

When ausing-declaration brings names from a base class into aderived class scope, member functions in the derived class override and/orhide member functions with the same name and parameter types in a baseclass (rather than conflicting).
to read:
When ausing-declaration brings names from a base class into aderived class scope, member functions and member function templates inthe derived class override and/or hide member functions and memberfunction templates with the same name, parameter-type-list(9.3.4.6 [dcl.fct]),andcv-qualification in a base class (rather than conflicting).

In 11.7.3 [class.virtual] paragraph 2 change:

If a virtual member functionvf is declared in a classBase and in a classDerived, derived directly orindirectly fromBase, a member functionvf with thesame name and same parameter list asBase::vf is declared,thenDerived::vf is also virtual (whether or not it is sodeclared) and it overridesBase::vf.
to read:
If a virtual member functionvf is declared in a classBase and in a classDerived, derived directly orindirectly fromBase, a member functionvf with thesame name, parameter-type-list (9.3.4.6 [dcl.fct]), andcv-qualification asBase::vfis declared, thenDerived::vf is also virtual (whether or notit is so declared) and it overridesBase::vf.

Seeissue 140 for the definition ofparameter-type-list.




[8]ページ先頭

©2009-2026 Movatter.jp