[clang] [Clang][NFC] Rearrange tests for CWG 2707 after #110473 (PR #110842)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 2 07:34:48 PDT 2024
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/110842
>From 5660d1ee7f5b815061f04e2f77eb1abced041ea6 Mon Sep 17 00:00:00 2001
From: Younan Zhang <zyn7109 at gmail.com>
Date: Wed, 2 Oct 2024 21:41:53 +0800
Subject: [PATCH 1/2] [Clang][NFC] Rearrange tests for CWG 2707 after #110473
---
clang/test/CXX/drs/cwg27xx.cpp | 64 +++++++++++++++++-----------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/clang/test/CXX/drs/cwg27xx.cpp b/clang/test/CXX/drs/cwg27xx.cpp
index 581e2af822d556..cb08c17b4b3bef 100644
--- a/clang/test/CXX/drs/cwg27xx.cpp
+++ b/clang/test/CXX/drs/cwg27xx.cpp
@@ -2,9 +2,9 @@
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++14 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -pedantic-errors -verify=expected %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -pedantic-errors -verify=expected %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -pedantic-errors -verify=expected,since-cxx23 %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++2c -pedantic-errors -verify=expected,since-cxx23,since-cxx26 %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -pedantic-errors -verify=expected,since-cxx20 %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -pedantic-errors -verify=expected,since-cxx20,since-cxx23 %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++2c -pedantic-errors -verify=expected,since-cxx20,since-cxx23,since-cxx26 %s
#if __cplusplus == 199711L
#define static_assert(...) __extension__ _Static_assert(__VA_ARGS__)
@@ -29,6 +29,35 @@ namespace std {
#endif
} // namespace std
+namespace cwg2707 { // cwg2707: 20
+
+#if __cplusplus >= 202002L
+
+template <class T, unsigned N> struct A { // #cwg2707-A
+ T value[N];
+};
+
+template <typename... T>
+A(T...) -> A<int, sizeof...(T)> requires (sizeof...(T) == 2); // #cwg2707-guide-A
+
+// Brace elision is not allowed for synthesized CTAD guides if the array size
+// is value-dependent.
+// So this should pick up our explicit deduction guide.
+A a = {1, 2};
+
+A b = {3, 4, 5};
+// since-cxx20-error at -1 {{no viable constructor or deduction guide}} \
+// since-cxx20-note@#cwg2707-A {{candidate function template not viable}} \
+// since-cxx20-note@#cwg2707-A {{implicit deduction guide}} \
+// since-cxx20-note@#cwg2707-guide-A {{constraints not satisfied}} \
+// since-cxx20-note@#cwg2707-guide-A {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}} \
+// since-cxx20-note@#cwg2707-A {{candidate function template not viable}} \
+// since-cxx20-note@#cwg2707-A {{implicit deduction guide}}
+
+#endif
+
+} // namespace cwg2707
+
namespace cwg2718 { // cwg2718: 2.7
struct B {};
struct D;
@@ -200,32 +229,3 @@ static_assert(false, f().s);
// since-cxx26-error at -1 {{static assertion failed: Hello}}
#endif
} // namespace cwg2798
-
-namespace cwg2707 { // cwg2707: 20
-
-#if __cplusplus >= 202002L
-
-template <class T, unsigned N> struct A {
- T value[N];
-};
-
-template <typename... T>
-A(T...) -> A<int, sizeof...(T)> requires (sizeof...(T) == 2);
-
-// Brace elision is not allowed for synthesized CTAD guides if the array size
-// is value-dependent.
-// So this should pick up our explicit deduction guide.
-A a = {1, 2};
-
-A b = {3, 4, 5};
-// expected-error at -1 {{no viable constructor or deduction guide}} \
-// expected-note at -13 {{candidate function template not viable}} \
-// expected-note at -13 {{implicit deduction guide}} \
-// expected-note at -8 {{constraints not satisfied}} \
-// expected-note at -8 {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}} \
-// expected-note at -13 {{candidate function template not viable}} \
-// expected-note at -13 {{implicit deduction guide}}
-
-#endif
-
-} // namespace cwg2707
>From a24ba9cb01709668902b5b8d132014ededa35206 Mon Sep 17 00:00:00 2001
From: Younan Zhang <zyn7109 at gmail.com>
Date: Wed, 2 Oct 2024 22:33:58 +0800
Subject: [PATCH 2/2] Remove trailing slashes; add indents
---
clang/test/CXX/drs/cwg27xx.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/clang/test/CXX/drs/cwg27xx.cpp b/clang/test/CXX/drs/cwg27xx.cpp
index cb08c17b4b3bef..fb5c8b1d1fbf8b 100644
--- a/clang/test/CXX/drs/cwg27xx.cpp
+++ b/clang/test/CXX/drs/cwg27xx.cpp
@@ -46,13 +46,13 @@ A(T...) -> A<int, sizeof...(T)> requires (sizeof...(T) == 2); // #cwg2707-guide-
A a = {1, 2};
A b = {3, 4, 5};
-// since-cxx20-error at -1 {{no viable constructor or deduction guide}} \
-// since-cxx20-note@#cwg2707-A {{candidate function template not viable}} \
-// since-cxx20-note@#cwg2707-A {{implicit deduction guide}} \
-// since-cxx20-note@#cwg2707-guide-A {{constraints not satisfied}} \
-// since-cxx20-note@#cwg2707-guide-A {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}} \
-// since-cxx20-note@#cwg2707-A {{candidate function template not viable}} \
-// since-cxx20-note@#cwg2707-A {{implicit deduction guide}}
+// since-cxx20-error at -1 {{no viable constructor or deduction guide}}
+// since-cxx20-note@#cwg2707-A {{candidate function template not viable}}
+// since-cxx20-note@#cwg2707-A {{implicit deduction guide}}
+// since-cxx20-note@#cwg2707-guide-A {{constraints not satisfied}}
+// since-cxx20-note@#cwg2707-guide-A {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}}
+// since-cxx20-note@#cwg2707-A {{candidate function template not viable}}
+// since-cxx20-note@#cwg2707-A {{implicit deduction guide}}
#endif
More information about the cfe-commits
mailing list