[PATCH] D152746: [C++20][Modules] Complete implementation of module.import p7.
Iain Sandoe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 12 12:51:38 PDT 2023
iains created this revision.
Herald added a subscriber: ChuanqiXu.
Herald added a project: All.
iains edited the summary of this revision.
iains added a reviewer: ChuanqiXu.
iains added a subscriber: clang-modules.
iains published this revision for review.
iains added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
many thanks to Daniela Engert from bringing this to my attention (and providing a reproducer test case).
The following test fails to compile TU b.cpp because we are not making the transitively imported modules visible (per [module.import]/p7)
a.cppm:
export module a;
export int foo() {
return 42;
}
b.cppm:
export module b;
import a;
export int bar();
b.cpp:
module b;
int bar() {
return foo();
}
clang++ -c -std=c++2b -fmodule-output a.cppm
clang++ -c -std=c++2b -fmodule-output -fprebuilt-module-path=. b.cppm
clang++ -c -std=c++2b -fprebuilt-module-path=. b.cpp
b.cpp:4:12: error: declaration of 'foo' must be imported from module 'a' before it is required
return foo();
This is fixed by the following patch (which also addresses a FIXME in basic.def.odr/p6.cppm).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152746
Files:
clang/include/clang/Basic/Module.h
clang/lib/Basic/Module.cpp
clang/lib/Sema/SemaModule.cpp
clang/test/CXX/module/basic/basic.def.odr/p6.cppm
clang/test/CXX/module/module.import/p7.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152746.530643.patch
Type: text/x-patch
Size: 4262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230612/840f4113/attachment.bin>
More information about the cfe-commits
mailing list