Title
Empty destructuring expansion statements
Status
tentatively ready
Section
8.7 [stmt.expand]
Submitter
Jakub Jelinek

Created on 2025-08-09.00:00:00 last changed 1 month ago

Messages

Date: 2025-09-12.22:42:26

Proposed resolution (approved by CWG 2025-09-12):

Change in 8.7 [stmt.expand] bullet 5.3 as follows:

  • Otherwise, S is a destructuring expansion statement and, if N is 0, S is equivalent to:
    {
      init-statement
      constexpropt auto&& range = expansion-initializer ;
    }
    
    otherwise, S is equivalent to: ...
Date: 2025-09-12.22:42:26

(From submission #743.)

Consider:

struct S { };
void f() {
  S s;
  template for (auto x : s) { }
}

This destructuring expansion statement is ill-formed, because the syntactic rewrite contains

  auto&& [] = s ;

which is an ill-formed structured binding declaration.

Empty expansion statements are allowed for the other two kinds of expansion statements.

History
Date User Action Args
2025-09-12 22:42:26adminsetmessages: + msg8089
2025-09-12 22:42:26adminsetstatus: open -> tentatively ready
2025-08-09 00:00:00admincreate