Skip to content

Conversation

@kish1n
Copy link
Contributor

@kish1n kish1n commented Jul 4, 2025

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

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 4, 2025

@llvm/pr-subscribers-clang

Author: Ashwin Kishin Banwari (kish1n)

Changes

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 --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>

@kish1n
Copy link
Contributor Author

kish1n commented Jul 5, 2025

@ChuanqiXu9

@ChuanqiXu9 ChuanqiXu9 merged commit 84be785 into llvm:main Jul 8, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants