mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-02 06:36:08 +00:00

This patch implements P0960R3, which allows initialization of aggregates via parentheses. As an example: ``` struct S { int i, j; }; S s1(1, 1); int arr1[2](1, 2); ``` This patch also implements P1975R0, which fixes the wording of P0960R3 for single-argument parenthesized lists so that statements like the following are allowed: ``` S s2(1); S s3 = static_cast<S>(1); S s4 = (S)1; int (&&arr2)[] = static_cast<int[]>(1); int (&&arr3)[2] = static_cast<int[2]>(1); ``` This patch was originally authored by @0x59616e and completed by @ayzhao. Fixes #54040, Fixes #54041 Co-authored-by: Sheng <ox59616e@gmail.com> Full write up : https://discourse.llvm.org/t/c-20-rfc-suggestion-desired-regarding-the-implementation-of-p0960r3/63744 Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D129531