mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-29 22:02:42 +01:00
Support for initialization of classes with abstract base classes. (#6802)
When initializing `.base` in class initialization, use `partial Base` as the destination type rather than `Base`. Treat `partial Base` as not being abstract even when `Base` is. Allow conversion from a `partial T` initializer to a `T` initializer. Store the vptr while performing the conversion. Do not store the vptr when performing a `partial T` initialization, only when performing a non-partial `T` initialization.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "common/vlog.h"
|
||||
#include "toolchain/base/kind_switch.h"
|
||||
#include "toolchain/sem_ir/diagnostic_loc_converter.h"
|
||||
#include "toolchain/sem_ir/expr_info.h"
|
||||
#include "toolchain/sem_ir/file.h"
|
||||
#include "toolchain/sem_ir/generic.h"
|
||||
|
||||
@@ -293,6 +294,12 @@ auto FunctionContext::InitializeStorage(TypeInFile type, SemIR::InstId dest_id,
|
||||
}
|
||||
}
|
||||
|
||||
auto FunctionContext::InitializeStorage(SemIR::InstId init_id) -> void {
|
||||
InitializeStorage(GetTypeIdOfInst(init_id),
|
||||
SemIR::FindStorageArgForInitializer(sem_ir(), init_id),
|
||||
init_id);
|
||||
}
|
||||
|
||||
auto FunctionContext::GetTypeIdOfInst(SemIR::InstId inst_id) -> TypeInFile {
|
||||
auto [file, type_id] = SemIR::GetTypeOfInstInSpecific(
|
||||
specific_sem_ir(), specific_id(), sem_ir(), inst_id);
|
||||
|
||||
Reference in New Issue
Block a user