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


2663. Example for member redeclarations with using-declarations

Section: 9.9  [namespace.udecl]     Status: DRWP     Submitter: Shafik Yaghmour     Date: 2022-11-28

[Accepted as a DR at the June, 2023 meeting.]

Issue 36 was resolved by P1787R6, but no example was added.

Proposed resolution (approved by CWG 2023-06-13):

  1. Add an example to 9.9 [namespace.udecl] paragraph 8 as follows:

    [ Example:
    struct C {
      int i;
    };
    
    struct D1 : C { };
    struct D2 : C { };
    
    struct D3 : D1, D2 {
      using D1::i;   // OK, equivalent to using C::i
      using D1::i;   // error: duplicate
      using D2::i;   // error: duplicate, also names C::i
    };
    
    -- end example ]
  2. Change the example in 9.9 [namespace.udecl] paragraph 10 as follows:

      using B::x;
      using A::x;              // OK, hides struct B::x
      using A::x;              // OK, does not conflict with previous using A::x
      x = 99;                  // assigns to A::x
      struct x x1;             // x1 has class type B::x
    }
    

CWG 2023-01-06

There is implementation divergence in handling this example.

CWG 2023-02-07

P1787R6 clarified that the example added to 9.9 [namespace.udecl] paragraph 10 is accepted, even in the non-function case.