Reference (section label): [stmt.expand]
Issue description
for (int x : { 1, }) { } // OK
template for (int x : { 1, }) { } // syntax error
Unlike any other brace-enclosed list, an expression-list in an expansion-init-list does not permit the use of trailing commas. This is almost certainly a cplusplus/papers#156 oversight given obvious inconsistencies and that the paper does not discuss this as a design choice.
Furthermore, existing implementations of expansion statements do not implement the standard behavior; see https://godbolt.org/z/czYqPG3r6.
Suggested resolution
Change the syntax of expansion-init-list as follows:
expansion-init-list:
- { expression-list opt }
+ { expression-list , opt }
+ { }
Reference (section label): [stmt.expand]
Issue description
Unlike any other brace-enclosed list, an expression-list in an expansion-init-list does not permit the use of trailing commas. This is almost certainly a cplusplus/papers#156 oversight given obvious inconsistencies and that the paper does not discuss this as a design choice.
Furthermore, existing implementations of expansion statements do not implement the standard behavior; see https://godbolt.org/z/czYqPG3r6.
Suggested resolution
Change the syntax of expansion-init-list as follows: