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

2025-09-28


3061. Trailing comma in an expansion-init-list

Section: 8.7  [stmt.expand]     Status: tentatively ready     Submitter: Jan Schultke     Date: 2025-08-24

(From submission #754.)

Brace-enclosed lists generally allow trailing commas. But an expansion-init-list does not; consider:

           for (int x : { 1, }) { }   // OK
  template for (int x : { 1, }) { }   // syntax error

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

Change in 8.7 [stmt.expand] paragraph 1 as follows:

  expansion-init-list :
       { expression-list ,opt }
       { }