https://github.com/localspook created 
https://github.com/llvm/llvm-project/pull/196889

[CWG988](https://wg21.link/cwg988) specifies that reference collapsing is 
performed when trying to form a reference to a `decltype`. Clang implements 
this since 2.7: https://godbolt.org/z/vYzKbv8x7 (and I checked a few versions 
after that to make sure there were no regressions).

>From e711e6b6f658bedea1fc59f88ec734d788e490d9 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <[email protected]>
Date: Sun, 10 May 2026 23:46:06 -0700
Subject: [PATCH] [clang][NFC] Mark CWG988 as implemented and add a test

---
 clang/test/CXX/drs/cwg9xx.cpp | 15 +++++++++++++++
 clang/www/cxx_dr_status.html  |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/cwg9xx.cpp b/clang/test/CXX/drs/cwg9xx.cpp
index c8fdca3a45c3e..a0c659cfc643a 100644
--- a/clang/test/CXX/drs/cwg9xx.cpp
+++ b/clang/test/CXX/drs/cwg9xx.cpp
@@ -169,6 +169,21 @@ enum struct E4 : int { e = static_cast<int>(E4()) };
 #endif
 } // namespace cwg977
 
+namespace cwg988 { // cwg988: 2.7
+#if __cplusplus >= 201103L
+void f() {
+  int i;
+  int& lvalue_ref = i;
+  int&& rvalue_ref = static_cast<int&&>(i);
+
+  static_assert(__is_same(decltype(lvalue_ref)&,  int&),  "");
+  static_assert(__is_same(decltype(lvalue_ref)&&, int&),  "");
+  static_assert(__is_same(decltype(rvalue_ref)&,  int&),  "");
+  static_assert(__is_same(decltype(rvalue_ref)&&, int&&), "");
+}
+#endif
+} // namespace cwg988
+
 namespace cwg990 { // cwg990: 3.5
 #if __cplusplus >= 201103L
   struct A { // #cwg990-A
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index feef0c3770f64..add0c344b5f18 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -6693,7 +6693,7 @@ <h2 id="cxxdr">C++ defect report implementation 
status</h2>
     <td>[<a href="https://wg21.link/dcl.type.simple";>dcl.type.simple</a>]</td>
     <td>CD2</td>
     <td>Reference-to-reference collapsing with <TT>decltype</TT></td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 2.7</td>
   </tr>
   <tr id="989">
     <td><a href="https://cplusplus.github.io/CWG/issues/989.html";>989</a></td>

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

Reply via email to