[clang] 9b53a6e - [Clang][NFC] Rearrange tests for CWG 2707 after #110473 (#110842)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 2 08:15:43 PDT 2024


Author: Younan Zhang
Date: 2024-10-02T23:15:38+08:00
New Revision: 9b53a6e7e5310e56c404766bf1cf3f21bff59229

URL: https://github.com/llvm/llvm-project/commit/9b53a6e7e5310e56c404766bf1cf3f21bff59229
DIFF: https://github.com/llvm/llvm-project/commit/9b53a6e7e5310e56c404766bf1cf3f21bff59229.diff

LOG: [Clang][NFC] Rearrange tests for CWG 2707 after #110473 (#110842)

This addresses comments from @Endilll in the post commit review of
#110473.

Added: 
    

Modified: 
    clang/test/CXX/drs/cwg27xx.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/cwg27xx.cpp b/clang/test/CXX/drs/cwg27xx.cpp
index 581e2af822d556..fb5c8b1d1fbf8b 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


        


More information about the cfe-commits mailing list