[clang] [clang][NFC] Mark CWG2780 as implemented and add a test (PR #195127)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 30 09:54:33 PDT 2026


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

[CWG2780](https://wg21.link/cwg2780) allows `reinterpret_cast`ing to a reference-to-function type. Clang already supports this: https://godbolt.org/z/c37hsvKnn

>From fccd2822e764cfeedaca7982f6207de2bc240731 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <chernyakin.victor.j at outlook.com>
Date: Thu, 30 Apr 2026 09:45:31 -0700
Subject: [PATCH] [clang][NFC] Mark CWG2780 as implemented and add a test

---
 clang/test/CXX/drs/cwg27xx.cpp | 10 ++++++++++
 clang/www/cxx_dr_status.html   |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/cwg27xx.cpp b/clang/test/CXX/drs/cwg27xx.cpp
index ae5874ce3c46d..dede0dc5aecc9 100644
--- a/clang/test/CXX/drs/cwg27xx.cpp
+++ b/clang/test/CXX/drs/cwg27xx.cpp
@@ -194,6 +194,16 @@ int j = f('a', 2);
 #endif
 } // namespace cwg2770
 
+namespace cwg2780 { // cwg2780: 2.7
+
+void f();
+
+void(&g())(int) {
+  return reinterpret_cast<void(&)(int)>(f);
+}
+
+} // namespace cwg2780
+
 namespace cwg2789 { // cwg2789: 18
 #if __cplusplus >= 202302L
 template <typename T = int>
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 51c3d87322d0a..4cc00c669b936 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -19269,7 +19269,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td>[<a href="https://wg21.link/expr.reinterpret.cast">expr.reinterpret.cast</a>]</td>
     <td>CD7</td>
     <td><TT>reinterpret_cast</TT> to reference to function types</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 2.7</td>
   </tr>
   <tr class="open" id="2781">
     <td><a href="https://cplusplus.github.io/CWG/issues/2781.html">2781</a></td>



More information about the cfe-commits mailing list