This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-08-20
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:
- 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.
- ...