aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorAlan Zhao <ayzhao@google.com>2023-01-04 15:12:00 -0800
committerAlan Zhao <ayzhao@google.com>2023-01-12 09:58:15 -0800
commit95a4c0c83554c025ef709a6805e67233d0dedba0 (patch)
tree26a4aefbb2ab9ade7f32529a630b8e8341f63459 /clang/lib/Frontend/InitPreprocessor.cpp
parent81f57b6b994907267e981e09c1789529ec0a91c9 (diff)
downloadllvm-95a4c0c83554c025ef709a6805e67233d0dedba0.zip
llvm-95a4c0c83554c025ef709a6805e67233d0dedba0.tar.gz
llvm-95a4c0c83554c025ef709a6805e67233d0dedba0.tar.bz2
[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
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 3e33d93..208c6a8 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -674,7 +674,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
// C++20 features.
if (LangOpts.CPlusPlus20) {
- // Builder.defineMacro("__cpp_aggregate_paren_init", "201902L");
+ Builder.defineMacro("__cpp_aggregate_paren_init", "201902L");
// P0848 is implemented, but we're still waiting for other concepts
// issues to be addressed before bumping __cpp_concepts up to 202002L.