Skip to content

Commit ca0b566

Browse files
authored
[NFC] [C++] [Modules] Mark P1979 as implemented and add test (#146841)
Proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1979r0.html appears to already be implemented as of Clang17. See: https://godbolt.org/z/h59Mvzq6P
1 parent ec25a05 commit ca0b566

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

clang/test/SemaCXX/P1979.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: rm -rf %t
2+
// RUN: split-file %s %t
3+
4+
5+
// RUN: %clang_cc1 -std=c++20 -verify -emit-module-interface %t/A.cpp -o %t/A.pcm
6+
// RUN: %clang_cc1 -std=c++20 -verify -emit-module-interface %t/myV.cpp -o %t/myV.pcm
7+
// RUN: %clang_cc1 -std=c++20 -verify -emit-module-interface -fmodule-file=V=%t/myV.pcm %t/partition.cpp -o %t/partition.pcm
8+
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify -fmodule-file=V=%t/myV.pcm -fmodule-file=A=%t/A.pcm -fmodule-file=A:partition=%t/partition.pcm %t/interface.cpp
9+
10+
//--- A.cpp
11+
// expected-no-diagnostics
12+
export module A;
13+
14+
//--- myV.cpp
15+
// expected-no-diagnostics
16+
export module V;
17+
18+
export struct myV{};
19+
20+
//--- uses_vector.h
21+
// expected-no-diagnostics
22+
#ifndef x
23+
#define x
24+
25+
import V;
26+
#endif
27+
28+
//--- partition.cpp
29+
// expected-no-diagnostics
30+
module;
31+
#include "uses_vector.h" // textually expands to import V;
32+
module A:partition;
33+
34+
//--- interface.cpp
35+
module A;
36+
import :partition;
37+
myV V; // expected-error {{declaration of 'myV' must be imported from module 'V' before it is required}}
38+
// expected-note@myV.cpp:4 {{declaration here is not visible}}

clang/www/cxx_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ <h2 id="cxx20">C++20 implementation status</h2>
923923
</tr>
924924
<tr> <!-- from Belfast -->
925925
<td><a href="https://wg21.link/p1979r0">P1979R0</a></td>
926-
<td class="none" align="center">No</td>
926+
<td class="full" align="center">Clang 17</td>
927927
</tr>
928928
<tr> <!-- from Prague -->
929929
<td><a href="https://wg21.link/p1779r3">P1779R3</a></td>

0 commit comments

Comments
 (0)