[clang] Reland parenthesized aggregate init patches
This commit relands the patches for implementing P0960R3 and P1975R0,
which describe initializing aggregates via a parenthesized list.
The relanded commits are:
*
40c52159d3ee - P0960R3 and P1975R0: Allow initializing aggregates from
a parenthesized list of values
*
c77a91bb7ba7 - Remove overly restrictive aggregate paren init logic
*
32d7aae04fdb - Fix a clang crash on invalid code in C++20 mode
This patch also fixes a crash in the original implementation.
Previously, if the input tried to call an implicitly deleted copy or
move constructor of a union, we would then try to initialize the union
by initializing it's first element with a reference to a union. This
behavior is incorrect (we should fail to initialize) and if the type of
the first element has a constructor with a single template typename
parameter, then Clang will explode. This patch fixes that issue by
checking that constructor overload resolution did not result in a
deleted function before attempting parenthesized aggregate
initialization.
Additionally, this patch also includes D140159, which contains some
minor fixes made in response to code review comments in the original
implementation that were made after that patch was submitted.
Co-authored-by: Sheng <ox59616e@gmail.com>
Fixes #54040, Fixes #59675
Reviewed By: ilya-biryukov
Differential Revision: https://reviews.llvm.org/D141546