aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorAlan Zhao <ayzhao@google.com>2022-10-03 10:46:46 -0700
committerAlan Zhao <ayzhao@google.com>2022-12-14 07:54:15 -0800
commit40c52159d3ee337dbed14e4c73b5616ea354c337 (patch)
tree1dcf0103adeefd635ed25879ec3a09690bf3cbca /clang/lib/Frontend/InitPreprocessor.cpp
parentc165b0553a96394b9bbf3984782703cdae99821d (diff)
downloadllvm-40c52159d3ee337dbed14e4c73b5616ea354c337.zip
llvm-40c52159d3ee337dbed14e4c73b5616ea354c337.tar.gz
llvm-40c52159d3ee337dbed14e4c73b5616ea354c337.tar.bz2
[clang][C++20] P0960R3 and P1975R0: Allow initializing aggregates from a parenthesized list of values
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
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.