aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/ConstructorGen.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-24 18:01:36 +0000
committer_ov4 <ov4@ov4.org>2026-10-24 18:01:36 +0000
commit0900667401415a0914b8a1510543c7c7eaf32e53 (patch)
treee61c43059f880878bc59259e82c5ab6665b20dbd /lib/CodeGen/ConstructorGen.cc
parent034ab48c5f30b0e6f402766b4c1bcf36661e16cd (diff)
feat(overload): select overloads by return type as well as parameters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/ConstructorGen.cc')
-rw-r--r--lib/CodeGen/ConstructorGen.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/CodeGen/ConstructorGen.cc b/lib/CodeGen/ConstructorGen.cc
index e956f9d..f598494 100644
--- a/lib/CodeGen/ConstructorGen.cc
+++ b/lib/CodeGen/ConstructorGen.cc
@@ -20,6 +20,7 @@ void CodeGen::transferObjects(const std::vector<size_t> &Objects) {
Value *CodeGen::emitOwnedValue(ExprAST *Expr, const TypeInfo *Type,
std::vector<size_t> &Transfers) {
+ expectResult(Expr, Type);
if (!Type || (!Type->IsClass && !containsString(Type))) return emitCoercedExpr(Expr, Type);
const TypeInfo *Source = getExprTypeInfo(Expr);
// A CHAR argument becomes a fresh STRING temporary, owned like any other.
@@ -146,6 +147,7 @@ Value *CodeGen::symbolAddress(const SymbolInfo &Info) {
void CodeGen::emitAssignment(const LValueInfo &Target, ExprAST *Expr, const SymbolInfo *Symbol) {
const TypeInfo *Info = resolveType(Target.TypeName);
+ expectResult(Expr, Info);
if (auto *New = dynamic_cast<NewExprAST*>(Expr)) {
SaveAndRestore<int> Location(DiagnosticLine, New->getLine());
const TypeInfo *Class = resolveType(New->getClassName());