aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-12-01 14:10:59 +0000
committergingerBill <bill@gingerbill.org>2019-12-01 14:10:59 +0000
commit9db81498d8fbf4b24383cd7de94619943ad4e01a (patch)
tree6263d1649607f44a1d8affc2baf1d39da906698f /src/check_type.cpp
parent7fbe0a6f2385e618ea4d3a724d2ed6147b6921bf (diff)
Make the `string` type elements "immutable", akin to `char const *` in C
Allows for extra security and optimization benefits
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index c9e8f3a89..550761d78 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1186,7 +1186,12 @@ bool check_type_specialization_to(CheckerContext *ctx, Type *specialization, Typ
return false;
}
- if (t->kind == Type_Struct) {
+ if (is_type_untyped(t)) {
+ Operand o = {Addressing_Value};
+ o.type = default_type(type);
+ bool can_convert = check_cast_internal(ctx, &o, specialization);
+ return can_convert;
+ } else if (t->kind == Type_Struct) {
if (t->Struct.polymorphic_parent == specialization) {
return true;
}