================
@@ -7388,7 +7388,24 @@ 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 module unit currently being compiled is usable here
+ /// ([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: that check consults
+ /// ASTContext's current *named* module, which is not in scope yet while
the
+ /// GMF's pending instantiations run. Comparing against the current module
+ /// scope instead recognises it as belonging to this unit. Only genuinely
+ /// cross-unit uses stay subject to the internal-linkage rule.
----------------
combinatorial wrote:
The comment has been shortened to a single sentence.
https://github.com/llvm/llvm-project/pull/210825
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits