This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
[Accepted as a DR at the February, 2023 meeting.]
Consider:
template <class T> struct A { T ar[4]; }; A a = { "foo" };
Subclause 12.2.2.9 [over.match.class.deduct] bullet 1.5 specifies:
For each xi, let ei be the corresponding aggregate element of C or of one of its (possibly recursive) subaggregates that would be initialized by xi (9.4.2 [dcl.init.aggr]) if
- brace elision is not considered for any aggregate element that has a dependent non-array type or an array type with a value-dependent bound, and
- ...
The normative rule does not properly consider arrays with dependent element type, initialized by a string literal. MSVC accepts, gcc and clang reject the example.
Suggested resolution [SUPERSEDED]:
Change in 12.2.2.9 [over.match.class.deduct] bullet 1.5 as follows:
For each xi, let ei be the corresponding aggregate element of C or of one of its (possibly recursive) subaggregates that would be initialized by xi (9.4.2 [dcl.init.aggr]) if
- brace elision is not considered for any aggregate element that has
- a dependent non-array type
or,- an array type with a value-dependent bound, or
- a string literal as the corresponding initializer and that has an array type whose element type is a (possibly cv-qualified) template parameter or is a dependent type specified with a qualified-id whose nested-name-specifier is dependent or with a decltype-specifier; and
- ...
Proposed resolution (approved by CWG 2023-02-09):
Change in 12.2.2.9 [over.match.class.deduct] bullet 1.5 as follows:
For each xi, let ei be the corresponding aggregate element of C or of one of its (possibly recursive) subaggregates that would be initialized by xi (9.4.2 [dcl.init.aggr]) if
- brace elision is not considered for any aggregate element that has
- a dependent non-array type
or,- an array type with a value-dependent bound, or
- an array type with a dependent array element type and xi is a string literal; and
- ...