File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1614,7 +1614,7 @@ bool Sema::isUsableModule(const Module *M) {
1614
1614
1615
1615
// Otherwise, the global module fragment from other translation unit is not
1616
1616
// directly usable.
1617
- if (M->isGlobalModule ())
1617
+ if (M->isExplicitGlobalModule ())
1618
1618
return false ;
1619
1619
1620
1620
Module *Current = getCurrentModule ();
@@ -1628,6 +1628,8 @@ bool Sema::isUsableModule(const Module *M) {
1628
1628
// module should be visible to the decls in the implicit global module.
1629
1629
if (Current->isImplicitGlobalModule ())
1630
1630
Current = Current->getTopLevelModule ();
1631
+ if (M->isImplicitGlobalModule ())
1632
+ M = M->getTopLevelModule ();
1631
1633
1632
1634
// If M is the module we're parsing or M and the current module unit lives in
1633
1635
// the same module, M should be usable.
Original file line number Diff line number Diff line change
1
+ // RUN: rm -rf %t
2
+ // RUN: mkdir %t
3
+ // RUN: split-file %s %t
4
+ //
5
+ // RUN: %clang_cc1 -std=c++20 %t/a.interface.cppm -emit-module-interface -o %t/a.pcm
6
+ // RUN: %clang_cc1 -std=c++20 %t/a.impl.cc -fmodule-file=a:interface=%t/a.pcm \
7
+ // RUN: -verify -fsyntax-only
8
+
9
+ // --- a.interface.cppm
10
+ export module a:interface;
11
+ extern " C++" constexpr int a = 43 ;
12
+
13
+ // --- a.impl.cc
14
+ // expected-no-diagnostics
15
+ module a:impl;
16
+ import :interface;
17
+ static_assert (a == 43 );
18
+
You can’t perform that action at this time.
0 commit comments