Title
Repeated structured binding declarations
Status
open
Section
6.6 [basic.link]
Submitter
Jim X

Created on 2023-02-13.00:00:00 last changed 13 months ago

Messages

Date: 2023-03-11.18:26:11

Suggested resolution:

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

For any two declarations of an entity E:
  • If one declares E to be a variable or function, the other shall declare E as one of the same type.
  • If one declares E to be an enumerator, the other shall do so.
  • If one declares E to be a structured binding, the program is ill-formed.
  • ...
Date: 2023-02-13.00:00:00

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.

History
Date User Action Args
2023-03-11 18:26:11adminsetmessages: + msg7226
2023-02-13 00:00:00admincreate