Created on 2020-07-14.00:00:00 last changed 17 months ago
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
- ...
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
- ...
[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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-07-16 13:00:43 | admin | set | status: open -> c++23 |
2023-07-16 13:00:43 | admin | set | status: dr -> open |
2023-02-18 18:43:04 | admin | set | status: ready -> dr |
2023-02-10 23:01:52 | admin | set | status: tentatively ready -> ready |
2023-02-10 02:22:55 | admin | set | status: review -> tentatively ready |
2023-02-09 03:12:55 | admin | set | messages: + msg7180 |
2023-02-09 03:12:55 | admin | set | status: open -> review |
2023-01-15 15:49:37 | admin | set | messages: + msg7140 |
2020-07-14 00:00:00 | admin | create |