Skip to content

Commit aac4d03

Browse files
committed
[C++20] [Modules] Mark exported all declarations as used
Close #85122 As the title suggested, it looks pretty sensible.
1 parent 3090efc commit aac4d03

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/lib/Sema/SemaModule.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,10 @@ Decl *Sema::ActOnFinishExportDecl(Scope *S, Decl *D, SourceLocation RBraceLoc) {
10031003
}
10041004
}
10051005

1006+
// Anything exported from a module should never be considered unused.
1007+
for (auto *Exported : ED->decls())
1008+
Exported->markUsed(getASTContext());
1009+
10061010
return D;
10071011
}
10081012

clang/test/Modules/pr85122.cppm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %clang_cc1 -std=c++20 %s -Wall -fsyntax-only -verify
2+
3+
// expected-no-diagnostics
4+
export module a;
5+
6+
export constexpr auto a = []{};

0 commit comments

Comments
 (0)