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

2024-11-11


2706. Repeated structured binding declarations

Section: 6.6  [basic.link]     Status: open     Submitter: Jim X     Date: 2023-02-13

Consider:

  struct A {
    int a;
  };
  struct B {
    int b;
  };
  auto&& [x] = A{}; //#1
  auto&& [x] = B{}; //#2

A rule is missing to make such repeated structured binding declarations ill-formed.

Suggested resolution:

Change in 6.6 [basic.link] paragraph 11 as follows:

For any two declarations of an entity E: