[clang] [Clang][test] Relocate concepts regression test to concepts-subsumption.cpp NFC (PR #215762)
Shengxin Pei via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 12 02:31:50 PDT 2026
https://github.com/TPPPP72 created https://github.com/llvm/llvm-project/pull/215762
None
>From ec5fb83e47a90025479f387a5b4beb73e5981742 Mon Sep 17 00:00:00 2001
From: Shengxin Pei <TPPPP72 at outlook.com>
Date: Tue, 11 Aug 2026 00:20:46 +0800
Subject: [PATCH 1/4] [clang] Add test for CWG 2006 and update status
---
clang/test/CXX/drs/cwg20xx.cpp | 83 ++++++++++++++++++++++++++++++++++
clang/www/cxx_dr_status.html | 2 +-
2 files changed, 84 insertions(+), 1 deletion(-)
diff --git a/clang/test/CXX/drs/cwg20xx.cpp b/clang/test/CXX/drs/cwg20xx.cpp
index 75b4094283db0..13286ef446325 100644
--- a/clang/test/CXX/drs/cwg20xx.cpp
+++ b/clang/test/CXX/drs/cwg20xx.cpp
@@ -11,6 +11,89 @@
// cxx98-error at -1 {{variadic macros are a C99 feature}}
#endif
+namespace std { class type_info; }
+namespace cwg2006 { // cwg2006: 2.7
+ void test_object_pointer(const void *cp, volatile void *vp, const volatile void *cvp) {
+ (void)static_cast<const void*>(cp);
+ (void)static_cast<volatile void*>(vp);
+ (void)static_cast<const volatile void*>(cvp);
+
+ int x = 0;
+ const int cx = 0;
+ const void *p1 = &x;
+ const void *p2 = &cx;
+ (void)p1;
+ (void)p2;
+ }
+
+ void test_cast(int x) {
+ (const void)x;
+ (volatile void)x;
+ (const volatile void)x;
+ }
+
+ const void get_const_void()
+#if __cplusplus >= 201103L
+ noexcept
+#endif
+ {}
+
+ volatile void get_volatile_void()
+#if __cplusplus >= 201103L
+ noexcept
+#endif
+ {}
+ // since-cxx20-warning at -5 {{volatile-qualified return type 'volatile void' is deprecated}}
+
+ const volatile void get_cv_void()
+#if __cplusplus >= 201103L
+ noexcept
+#endif
+ {}
+ // since-cxx20-warning at -5 {{volatile-qualified return type 'const volatile void' is deprecated}}
+
+ void test_return() {
+ return get_const_void();
+ }
+
+ void test_return_volatile() {
+ return get_volatile_void();
+ }
+
+ void test_return_cv() {
+ return get_cv_void();
+ }
+
+ void test_conditional(bool b) {
+ b ? get_const_void() : get_const_void();
+ b ? get_volatile_void() : get_const_void();
+ b ? get_cv_void() : get_const_void();
+ }
+
+ namespace std { class type_info; }
+ void test_typeid() {
+ (void)typeid(const void);
+ (void)typeid(volatile void);
+ (void)typeid(const volatile void);
+ }
+
+#if __cplusplus >= 201103L
+ template <typename T, typename U>
+ struct is_same { static constexpr bool value = false; };
+
+ template <typename T>
+ struct is_same<T, T> { static constexpr bool value = true; };
+
+ void test_cxx11() {
+ decltype(get_const_void()) *p = nullptr;
+ static_assert(noexcept(get_const_void()), "");
+
+ using CommonType = decltype(true ? get_const_void() : get_volatile_void());
+ static_assert(is_same<CommonType, void>::value, "");
+ }
+#endif
+} // namespace cwg2006
+
namespace cwg2007 { // cwg2007: 3.4
template<typename T> struct A { typename T::error e; };
template<typename T> struct B { };
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 4d29e6b4b32f4..40cac7f440832 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -13831,7 +13831,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/basic.compound">basic.compound</a>]</td>
<td>CD4</td>
<td>Cv-qualified <TT>void</TT> types</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 2.7</td>
</tr>
<tr id="2007">
<td><a href="https://cplusplus.github.io/CWG/issues/2007.html">2007</a></td>
>From a4eb6481014f46642aeeb88e4e7d8ed2e7df7e86 Mon Sep 17 00:00:00 2001
From: Shengxin Pei <TPPPP72 at outlook.com>
Date: Tue, 11 Aug 2026 00:37:27 +0800
Subject: [PATCH 2/4] remove an extra line
---
clang/test/CXX/drs/cwg20xx.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/clang/test/CXX/drs/cwg20xx.cpp b/clang/test/CXX/drs/cwg20xx.cpp
index 13286ef446325..45cf69c850dba 100644
--- a/clang/test/CXX/drs/cwg20xx.cpp
+++ b/clang/test/CXX/drs/cwg20xx.cpp
@@ -70,7 +70,6 @@ namespace cwg2006 { // cwg2006: 2.7
b ? get_cv_void() : get_const_void();
}
- namespace std { class type_info; }
void test_typeid() {
(void)typeid(const void);
(void)typeid(volatile void);
>From 54a9b941bb061488fa9a694918444736f75137d8 Mon Sep 17 00:00:00 2001
From: Shengxin Pei <TPPPP72 at outlook.com>
Date: Tue, 11 Aug 2026 16:10:36 +0800
Subject: [PATCH 3/4] use __is_same
---
clang/test/CXX/drs/cwg20xx.cpp | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/clang/test/CXX/drs/cwg20xx.cpp b/clang/test/CXX/drs/cwg20xx.cpp
index 45cf69c850dba..0f5622f4734c8 100644
--- a/clang/test/CXX/drs/cwg20xx.cpp
+++ b/clang/test/CXX/drs/cwg20xx.cpp
@@ -77,18 +77,12 @@ namespace cwg2006 { // cwg2006: 2.7
}
#if __cplusplus >= 201103L
- template <typename T, typename U>
- struct is_same { static constexpr bool value = false; };
-
- template <typename T>
- struct is_same<T, T> { static constexpr bool value = true; };
-
void test_cxx11() {
decltype(get_const_void()) *p = nullptr;
static_assert(noexcept(get_const_void()), "");
using CommonType = decltype(true ? get_const_void() : get_volatile_void());
- static_assert(is_same<CommonType, void>::value, "");
+ static_assert(__is_same(CommonType, void), "");
}
#endif
} // namespace cwg2006
>From 79d534717be0aa62336d3a563b012115103678b3 Mon Sep 17 00:00:00 2001
From: Shengxin Pei <TPPPP72 at outlook.com>
Date: Wed, 12 Aug 2026 17:28:58 +0800
Subject: [PATCH 4/4] [Clang][test] Relocate concepts regression test to
concepts-subsumption.cpp NFC
---
clang/test/SemaCXX/GH106182.cpp | 16 ----------------
clang/test/SemaCXX/concepts-subsumption.cpp | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 16 deletions(-)
delete mode 100644 clang/test/SemaCXX/GH106182.cpp
diff --git a/clang/test/SemaCXX/GH106182.cpp b/clang/test/SemaCXX/GH106182.cpp
deleted file mode 100644
index f82064bff27e9..0000000000000
--- a/clang/test/SemaCXX/GH106182.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
-// expected-no-diagnostics
-
-template <class Fn> struct A {
- constexpr A(Fn) {};
-};
-
-template <template <class> class S>
- void create_unique()
- requires (S{0}, true);
-
-template <template <class> class S>
- void create_unique()
- requires (S{0}, true) {}
-
-template void create_unique<A>();
diff --git a/clang/test/SemaCXX/concepts-subsumption.cpp b/clang/test/SemaCXX/concepts-subsumption.cpp
index d00a8b973cb91..d6691891467a6 100644
--- a/clang/test/SemaCXX/concepts-subsumption.cpp
+++ b/clang/test/SemaCXX/concepts-subsumption.cpp
@@ -147,6 +147,22 @@ constexpr int foo(Z auto y) { return 30; }
static_assert(foo(0) == 30);
}
+namespace GH106182 {
+template <class Fn> struct A {
+ constexpr A(Fn) {};
+};
+
+template <template <class> class S>
+void create_unique()
+ requires (S{0}, true);
+
+template <template <class> class S>
+void create_unique()
+ requires (S{0}, true) {}
+
+template void create_unique<A>();
+}
+
namespace WhateverThisIs {
template <typename T> concept C0 = true;
template <typename T> concept C1 = true;
More information about the cfe-commits
mailing list