[clang] [clang][NFC] Mark CWG2807 as implemented and add a test (PR #194755)
Victor Chernyakin via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 17:01:09 PDT 2026
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/194755
[CWG2807](https://wg21.link/cwg2807): One part of the standard (correctly) said destructors can't be `consteval`, but another said they can be.
Clang diagnosed this in 9.0, for some reason started accepting it in 10.0, then went back to diagnosing in 11.0: https://godbolt.org/z/eh1TTTd1K. I've marked it as implemented since 11.0.
The issue that prompted the DR: #65665
>From 4a7e9ce0ad6b870d0fb3ba649c20db939e085552 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <chernyakin.victor.j at outlook.com>
Date: Tue, 28 Apr 2026 16:58:45 -0700
Subject: [PATCH] [clang][NFC] Mark CWG2807 as implemented and add a test
---
clang/test/CXX/drs/cwg28xx.cpp | 10 ++++++++++
clang/www/cxx_dr_status.html | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/clang/test/CXX/drs/cwg28xx.cpp b/clang/test/CXX/drs/cwg28xx.cpp
index 9ec3cc5a1a346..b9b63a55564e9 100644
--- a/clang/test/CXX/drs/cwg28xx.cpp
+++ b/clang/test/CXX/drs/cwg28xx.cpp
@@ -6,6 +6,16 @@
// RUN: %clang_cc1 -std=c++23 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,cxx11-23,since-cxx20,since-cxx23 %s
// RUN: %clang_cc1 -std=c++2c -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx20,since-cxx23,since-cxx26 %s
+namespace cwg2807 { // cwg2807: 11
+
+#if __cplusplus >= 202002L
+struct s {
+ consteval ~s() {}
+ // since-cxx20-error at -1 {{destructor cannot be marked consteval}}
+};
+#endif
+
+} // namespace cwg2807
int main() {} // required for cwg2811
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 9c3ff1aac4b66..20ec0ce92b9b5 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -19458,7 +19458,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/class.dtor">class.dtor</a>]</td>
<td>CD7</td>
<td>Destructors declared <TT>consteval</TT></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 11</td>
</tr>
<tr class="open" id="2808">
<td><a href="https://cplusplus.github.io/CWG/issues/2808.html">2808</a></td>
More information about the cfe-commits
mailing list