forked from OSchip/llvm-project
[NFC] [C++20] [Modules] Update comments for handling friend
There is a comment contains a FIXME for the Module TS. And now the Module TS is merged so we should update the comment. I've checked the implementation.
This commit is contained in:
parent
9554aaa275
commit
2a14bc55c5
|
@ -1586,10 +1586,13 @@ void Sema::FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S,
|
|||
/// We've determined that \p New is a redeclaration of \p Old. Check that they
|
||||
/// have compatible owning modules.
|
||||
bool Sema::CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old) {
|
||||
// FIXME: The Modules TS is not clear about how friend declarations are
|
||||
// to be treated. It's not meaningful to have different owning modules for
|
||||
// linkage in redeclarations of the same entity, so for now allow the
|
||||
// redeclaration and change the owning modules to match.
|
||||
// [module.interface]p7:
|
||||
// A declaration is attached to a module as follows:
|
||||
// - If the declaration is a non-dependent friend declaration that nominates a
|
||||
// function with a declarator-id that is a qualified-id or template-id or that
|
||||
// nominates a class other than with an elaborated-type-specifier with neither
|
||||
// a nested-name-specifier nor a simple-template-id, it is attached to the
|
||||
// module to which the friend is attached ([basic.link]).
|
||||
if (New->getFriendObjectKind() &&
|
||||
Old->getOwningModuleForLinkage() != New->getOwningModuleForLinkage()) {
|
||||
New->setLocalOwningModule(Old->getOwningModule());
|
||||
|
|
Loading…
Reference in New Issue