https://github.com/TPPPP72 updated https://github.com/llvm/llvm-project/pull/215259
>From ec5fb83e47a90025479f387a5b4beb73e5981742 Mon Sep 17 00:00:00 2001 From: Shengxin Pei <[email protected]> Date: Tue, 11 Aug 2026 00:20:46 +0800 Subject: [PATCH 1/3] [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@-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@-5 {{volatile-qualified return type 'volatile void' is deprecated}} + + const volatile void get_cv_void() +#if __cplusplus >= 201103L + noexcept +#endif + {} + // since-cxx20-warning@-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 <[email protected]> Date: Tue, 11 Aug 2026 00:37:27 +0800 Subject: [PATCH 2/3] 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 <[email protected]> Date: Tue, 11 Aug 2026 16:10:36 +0800 Subject: [PATCH 3/3] 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 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
