Author: Shengxin Pei
Date: 2026-08-24T03:40:49+08:00
New Revision: 6b130f69f8f97b2c3306fe3fd70e3c11eb9701ef

URL: 
https://github.com/llvm/llvm-project/commit/6b130f69f8f97b2c3306fe3fd70e3c11eb9701ef
DIFF: 
https://github.com/llvm/llvm-project/commit/6b130f69f8f97b2c3306fe3fd70e3c11eb9701ef.diff

LOG: [clang] Add test for CWG 2006 and update status (#215259)

Clang already supports CWG 2006. Adding test cases and updating
`cxx_dr_status.html` to 2.7.

https://cplusplus.github.io/CWG/issues/2006.html

Assisted by Claude.

Added: 
    

Modified: 
    clang/test/CXX/drs/cwg20xx.cpp
    clang/www/cxx_dr_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/cwg20xx.cpp b/clang/test/CXX/drs/cwg20xx.cpp
index 75b4094283db0..5c23ef9c5240b 100644
--- a/clang/test/CXX/drs/cwg20xx.cpp
+++ b/clang/test/CXX/drs/cwg20xx.cpp
@@ -11,6 +11,92 @@
 // 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();
+  }
+
+  void test_typeid() {
+    (void)typeid(const void);
+    (void)typeid(volatile void);
+    (void)typeid(const volatile void);
+  }
+
+  void test_traits(){
+    static_assert(!__is_complete_type(const void), "");
+    static_assert(!__is_complete_type(volatile void), "");
+    static_assert(!__is_complete_type(const volatile void), "");
+
+    static_assert(!__is_object(const void), "");
+    static_assert(!__is_object(volatile void), "");
+    static_assert(!__is_object(const volatile void), "");
+  }
+
+#if __cplusplus >= 201103L
+  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), "");
+  }
+#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 ec29200198554..2d4449767f463 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>


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to