mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 16:21:04 +01:00
Fix accessing protected members from templates derived classes (#7780)
When evaluating a deferred member access action, the scope stack cannot be relied on, so `LookupUnqualifiedName` cannot be used in `GetHighestAllowedAccess` to get the `Self` type. Instead, store the `Self` type in the `Context` when evaluating a method, and use that in `GetHighestAllowedAccess`.
This commit is contained in:
@@ -122,7 +122,7 @@ auto CheckCppOverloadAccess(
|
||||
auto name_scope_const_id = context.constant_values().Get(
|
||||
context.name_scopes().Get(parent_scope_id).inst_id());
|
||||
SemIR::AccessKind allowed_access_kind =
|
||||
GetHighestAllowedAccess(context, loc_id, name_scope_const_id);
|
||||
GetHighestAllowedAccess(context, name_scope_const_id);
|
||||
CheckAccess(context, loc_id, SemIR::LocId(overload_inst_id), function.name_id,
|
||||
member_access_kind,
|
||||
/*is_parent_access=*/false,
|
||||
|
||||
Reference in New Issue
Block a user