mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Map structs and tuples to initializer lists in C++ overload resolution. (#6620)
When performing C++ overload resolution with an argument that is of
Carbon struct or tuple type, form a braced initializer list as the
placeholder argument. Note that this only affects overload resolution;
no new support for actually converting structs or tuples to C++ types is
added. In particular, while this does allow an empty class to be
initialized from `{}`, it does not allow a non-empty C++ class to be
initialized from a struct, as that is not yet supported in general.
---------
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
co-authored by
Carbon Infra Bot
Geoff Romer
parent
f3f498498f
commit
05ea0e77d9
@@ -2156,9 +2156,7 @@ static auto LookupMacro(Context& context, SemIR::NameScopeId scope_id,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Gets the identifier info for a name. Returns `nullptr` if the name is not an
|
||||
// identifier name.
|
||||
static auto GetIdentifierInfo(Context& context, SemIR::NameId name_id)
|
||||
auto GetClangIdentifierInfo(Context& context, SemIR::NameId name_id)
|
||||
-> clang::IdentifierInfo* {
|
||||
std::optional<llvm::StringRef> string_name =
|
||||
context.names().GetAsStringIfIdentifier(name_id);
|
||||
@@ -2183,7 +2181,8 @@ auto ImportNameFromCpp(Context& context, SemIR::LocId loc_id,
|
||||
return SemIR::ScopeLookupResult::MakeError();
|
||||
}
|
||||
|
||||
clang::IdentifierInfo* identifier_info = GetIdentifierInfo(context, name_id);
|
||||
clang::IdentifierInfo* identifier_info =
|
||||
GetClangIdentifierInfo(context, name_id);
|
||||
if (!identifier_info) {
|
||||
return SemIR::ScopeLookupResult::MakeNotFound();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user