This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 109a. See for the official list.


2341. Structured bindings with static storage duration

Section: 9.1  [dcl.pre]     Status: CD5     Submitter: John Spicer     Date: 2017-04-04

[Accepted at the February, 2019 meeting as part of paper P1091R3.]

According to 9.1 [dcl.pre] paragraph 8,

A simple-declaration with an identifier-list is called a structured binding declaration (9.6 [dcl.struct.bind]). The decl-specifier-seq shall contain only the type-specifier auto ( []) and cv-qualifiers.

This precludes block-scope structured bindings of static storage duration. However, namespace-scope structured bindings are permitted, and since those have static storage duration, it seems inconsistent to prohibit them at block scope. This restriction also prohibits inline structured bindings, which could be useful.

On the other hand, allowing storage class specifiers raises the question of to what extent they apply to the bindings as opposed to the container variable. That's subtle, because in two out of three cases, the bindings are not variables.

A related issue is that the linkage of structured bindings at namespace scope is not specified.