Skip to content

Commit

Permalink
[C++20] [Modules] Treat in class defined member functions in language…
Browse files Browse the repository at this point in the history
… linkage as implicitly inline

Close #108732

This looks liek an oversight mostly.

(cherry picked from commit 7046a9f)
  • Loading branch information
ChuanqiXu9 authored and tru committed Sep 24, 2024
1 parent b881b16 commit a8ddc3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9734,7 +9734,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
bool ImplicitInlineCXX20 = !getLangOpts().CPlusPlusModules ||
NewFD->isConstexpr() || NewFD->isConsteval() ||
!NewFD->getOwningModule() ||
NewFD->isFromExplicitGlobalModule() ||
NewFD->isFromGlobalModule() ||
NewFD->getOwningModule()->isHeaderLikeModule();
bool isInline = D.getDeclSpec().isInlineSpecified();
bool isVirtual = D.getDeclSpec().isVirtualSpecified();
Expand Down
14 changes: 14 additions & 0 deletions clang/test/Modules/pr108732.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %clang_cc1 -std=c++20 %s -ast-dump | FileCheck %s
export module mod;

extern "C++" {
class C
{
public:
bool foo() const {
return true;
}
};
}

// CHECK: foo {{.*}}implicit-inline

0 comments on commit a8ddc3c

Please sign in to comment.