[clang] [NFC] [C++] [Modules] Mark P1811 as implemented and add test (PR #146993)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 3 20:37:13 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Ashwin Kishin Banwari (kish1n)

<details>
<summary>Changes</summary>

This is already implemented. See godbolt: https://godbolt.org/z/7x3arqj3G

---
Full diff: https://github.com/llvm/llvm-project/pull/146993.diff


2 Files Affected:

- (added) clang/test/SemaCXX/P1811.cpp (+41) 
- (modified) clang/www/cxx_status.html (+1-1) 


``````````diff
diff --git a/clang/test/SemaCXX/P1811.cpp b/clang/test/SemaCXX/P1811.cpp
new file mode 100644
index 0000000000000..329110a2ce4dd
--- /dev/null
+++ b/clang/test/SemaCXX/P1811.cpp
@@ -0,0 +1,41 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+
+
+// RUN: %clang_cc1 -std=c++20 -verify -emit-module-interface %t/mod.cpp -o %t/mod.pcm
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify -fmodule-file=M=%t/mod.pcm %t/main1.cpp
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify -fmodule-file=M=%t/mod.pcm %t/main2.cpp
+
+//--- mod.cpp
+// expected-no-diagnostics
+module;
+#include "A.h"
+export module M;
+export A f() {return A{};}
+
+//--- A.h
+// expected-no-diagnostics
+#ifndef X
+#define X
+
+struct A{};
+
+#endif
+
+//--- main1.cpp
+// expected-no-diagnostics
+#include "A.h"
+import M;
+
+extern "C++" int main() {
+  A a;
+}
+
+//--- main2.cpp
+// expected-no-diagnostics
+import M;
+#include "A.h"
+
+extern "C++" int main() {
+  A a;
+}
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 831f79f7cf17a..4b149db9ecdf1 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -911,7 +911,7 @@ <h2 id="cxx20">C++20 implementation status</h2>
       </tr>
       <tr>
         <td><a href="https://wg21.link/p1811r0">P1811R0</a></td>
-        <td class="none" align="center">No</td>
+        <td class="full" align="center">Clang 17</td>
       </tr>
       <tr>
         <td><a href="https://wg21.link/p1703r1">P1703R1</a></td>

``````````

</details>


https://github.com/llvm/llvm-project/pull/146993


More information about the cfe-commits mailing list