Implement support for mixed-access overload sets. (#6137)

This turns out to be quite important, as several important standard
library types (such as `std::string`) have mixed-access overload sets
for their constructors as an implementation detail. The overall approach
here is:

- Use the most permissive access to determine the access of the overload
set itself. This affects whether name lookup finds the member name at
all.
- After overload resolution, re-check the access of the selected member,
if it's protected or private.

---------

Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
Richard Smith
2025-09-26 23:18:16 +00:00
committed by GitHub
co-authored by Dana Jansens
parent 83ba714165
commit 3b6d202730
11 changed files with 238 additions and 332 deletions
+2 -1
View File
@@ -206,7 +206,8 @@ auto LookupCppOperator(Context& context, SemIR::LocId loc_id, Operator op,
}
return ImportCppOverloadSet(context, SemIR::NameScopeId::None,
SemIR::NameId::CppOperator, functions);
SemIR::NameId::CppOperator,
/*naming_class=*/nullptr, std::move(functions));
}
} // namespace Carbon::Check