https://github.com/dgg5503 created 
https://github.com/llvm/llvm-project/pull/152233

Under C++17, `DeletedCopy` and `DefaultedCopy` in the test 
`clang/test/SemaOpenACC/private_firstprivate_reduction_required_ops.cpp` are 
eligible for aggregate initialization. Under C++20 and up, that is no longer 
the case. Therefore, an explicit constructor must be declared to avoid 
additional diagnostics which the test does not expect.

This test was failing in our downstream testing where our toolchain uses C++20 
as the default dialect.

See this reduced example for more details: https://godbolt.org/z/46oErYT43

>From 099aa071081fa652ecebf40226c675617bb8d08a Mon Sep 17 00:00:00 2001
From: Douglas Gliner <douglas.gli...@sony.com>
Date: Tue, 5 Aug 2025 17:40:49 -0700
Subject: [PATCH] [OpenACC] Improve C++20 compatibility of test

Under C++17, `DeletedCopy` and `DefaultedCopy` in the test
`clang/test/SemaOpenACC/private_firstprivate_reduction_required_ops.cpp` are
eligible for aggregate initialization. Under C++20 and up, that is no longer
the case. Therefore, an explicit constructor must be declared to avoid
additional diagnostics which the test does not expect.

This test was failing in our downstream testing where our toolchain uses C++20 
as the
default dialect.

See this reduced example for more details: https://godbolt.org/z/46oErYT43
---
 ...ivate_firstprivate_reduction_required_ops.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git 
a/clang/test/SemaOpenACC/private_firstprivate_reduction_required_ops.cpp 
b/clang/test/SemaOpenACC/private_firstprivate_reduction_required_ops.cpp
index 4644bdeeacc0e..ae7ac33fb391f 100644
--- a/clang/test/SemaOpenACC/private_firstprivate_reduction_required_ops.cpp
+++ b/clang/test/SemaOpenACC/private_firstprivate_reduction_required_ops.cpp
@@ -37,10 +37,26 @@ struct ImplicitDelDtor {
 };
 
 struct DeletedCopy {
+#if __cplusplus >= 202002L
+  // C++20 performs value-initialization while previous language versions
+  // performed aggregate-initialization. This class is also not eligible for
+  // an implicit default constructor. Therefore, the constructor must be
+  // explicitly declared for value-initialization to avoid additional
+  // diagnostics.
+  DeletedCopy();
+#endif
   DeletedCopy(const DeletedCopy&) = delete;
 };
 
 struct DefaultedCopy {
+#if __cplusplus >= 202002L
+  // C++20 performs value-initialization while previous language versions
+  // performed aggregate-initialization. This class is also not eligible for
+  // an implicit default constructor. Therefore, the constructor must be
+  // explicitly declared for value-initialization to avoid additional
+  // diagnostics.
+  DefaultedCopy();
+#endif
   DefaultedCopy(const DefaultedCopy&) = default;
 };
 struct UserCopy {

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to