diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d608dd92a4b479..d3c07d0a76f12e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -9732,6 +9732,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // the function decl is created above). // FIXME: We need a better way to separate C++ standard and clang modules. bool ImplicitInlineCXX20 = !getLangOpts().CPlusPlusModules || + NewFD->isConstexpr() || NewFD->isConsteval() || !NewFD->getOwningModule() || NewFD->isFromExplicitGlobalModule() || NewFD->getOwningModule()->isHeaderLikeModule(); diff --git a/clang/test/Modules/pr107673.cppm b/clang/test/Modules/pr107673.cppm new file mode 100644 index 00000000000000..dc66c9ac2245b3 --- /dev/null +++ b/clang/test/Modules/pr107673.cppm @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -std=c++20 %s -ast-dump | FileCheck %s +export module a; +export class f { +public: + void non_inline_func() {} + constexpr void constexpr_func() {} + consteval void consteval_func() {} +}; + +// CHECK-NOT: non_inline_func {{.*}}implicit-inline +// CHECK: constexpr_func {{.*}}implicit-inline +// CHECK: consteval_func {{.*}}implicit-inline