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) {
16141614
16151615 // Otherwise, the global module fragment from other translation unit is not
16161616 // directly usable.
1617- if (M->isGlobalModule ())
1617+ if (M->isExplicitGlobalModule ())
16181618 return false ;
16191619
16201620 Module *Current = getCurrentModule ();
@@ -1628,6 +1628,8 @@ bool Sema::isUsableModule(const Module *M) {
16281628 // module should be visible to the decls in the implicit global module.
16291629 if (Current->isImplicitGlobalModule ())
16301630 Current = Current->getTopLevelModule ();
1631+ if (M->isImplicitGlobalModule ())
1632+ M = M->getTopLevelModule ();
16311633
16321634 // If M is the module we're parsing or M and the current module unit lives in
16331635 // 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