Title
Structured bindings with static storage duration
Status
cd5
Section
9.1 [dcl.pre]
Submitter
John Spicer

Created on 2017-04-04.00:00:00 last changed 31 months ago

Messages

Date: 2019-02-15.00:00:00

[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 (9.2.9.7 [dcl.spec.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.

History
Date User Action Args
2022-04-28 07:01:06adminsetstatus: extension -> cd5
2017-04-04 00:00:00admincreate