Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


2506. Structured bindings and array cv-qualifiers

Section:9.7  [dcl.struct.bind]    Status:CD6    Submitter:Barry Revzin    Date:2018-12-11

[Accepted at the February, 2022 meeting.]

According to 9.7 [dcl.struct.bind] paragraph 1,

A structured binding declaration introduces theidentifiersv0,v1,v2, ... of theidentifier-list asnames ofstructured bindings. Letcv denotethecv-qualifiers in thedecl-specifier-seqandS consist of thestorage-class-specifiersof thedecl-specifier-seq (if any). Acv thatincludes volatile is deprecated; seeD.4 [depr.volatile.type]. First, a variable with a uniquenamee is introduced. Iftheassignment-expression in the initializer hasarray typeA and noref-qualifier ispresent,e is defined by

and each element is copy-initialized or direct-initializedfrom the corresponding element oftheassignment-expression as specified by the form ofthe initializer.

This means that in an example like

  const int arr[1]{};  auto [i] = arr;

i is a reference toconst int. Presumablythe fact that the array is copied should drop the array'scv-qualification.

Proposed resolution (December, 2021):

Change 9.7 [dcl.struct.bind] paragraph 1 as follows:

If theassignment-expression in the initializerhas array typecv1A andnoref-qualifier is present,e is definedby...




[8]ページ先頭

©2009-2026 Movatter.jp