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

2024-03-20


1063. [[hiding]] with non-attribute declarations

Section: _N3225_.7.6.5  [dcl.attr.override]     Status: C++11     Submitter: Daveed Vandevoorde     Date: 2010-03-23

[Voted into the WP at the March, 2011 meeting as part of paper N3272.]

There are some kinds of declarations that can appear in a derived class and hide names from a base class, but for which the syntax does not permit a [[hiding]] attribute. For example:

    struct B1 {
        int N;
        int M;
    };
    struct B2 {
        int M;
    };
    struct [[base_check]] D: B1, B2 {
        enum { N };    // hides B1::N but cannot take an attribute
        using B1::M;   // hides B2::M but cannot take an attribute
    };

Additional note (October, 2010):

alias-declarations should also be considered in this regard.

Notes from the November, 2010 meeting:

Paper N3206 did not address these cases; in fact, it introduced additional member declarations that cannot be annotated as hiding a base class member (function-definitions and template-declarations), because the new virt-specifier applies to a member-declarator and none of these member-declarations uses a member-declarator.

Additional note (November, 2010):

The injected-class-name can also hide a name from a base class but cannot be annotated with new.