================
@@ -7388,7 +7388,21 @@ void Sema::AddOverloadCandidate(
Function->isFromGlobalModule() &&
(IsImplicitlyInstantiated || Function->isInlined());
- if (ND->getFormalLinkage() == Linkage::Internal && !IsInlineFunctionInGMF)
{
+ /// An internal-linkage function declared in the global module fragment of
+ /// the *current* translation unit (as opposed to one imported from another
+ /// module's BMI) is usable within this module unit ([module.global.frag]
+ /// p1), even a plain 'static' (non-inline) helper. Such a helper is
dropped
+ /// here only because Function->isInAnotherModuleUnit() misclassifies it
+ /// when the enclosing template is instantiated after the GMF is closed
+ /// (the current named module is not yet in scope), which produced a bogus
+ /// "no matching function" error with no candidate notes. Only genuinely
+ /// cross-unit uses (Function came from an imported BMI) stay subject to
the
+ /// internal-linkage rule.
+ const bool IsCurrentUnitGMFDecl =
+ Function->isFromGlobalModule() && !Function->isFromASTFile();
----------------
ChuanqiXu9 wrote:
I prefer to use Sema::getCurrentModule and compare the result than
`isFromASTFile`
https://github.com/llvm/llvm-project/pull/210825
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits