aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorJoseph Battelle <bttelle@iom.io>2020-09-13 22:58:05 -0700
committerJoseph Battelle <bttelle@iom.io>2020-09-13 22:58:05 -0700
commit2f32b8fb3d80eb835da2a3e63c7549edc30ea88c (patch)
tree1ae182e21e4dd9fc4aee3ad90e418ec6a460695a /src/check_type.cpp
parent1fd1203d8bf1977366dbf1f366623924e5c3e5c0 (diff)
Fix issue #515
Modify `check_type_specialization_to` to require exact values to be equal when called with constant basic types. This also now allows procedure group members to differ only by constant value specializations. See the further example in the issue.
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index e71a1b102..24434dba0 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1253,7 +1253,13 @@ bool check_type_specialization_to(CheckerContext *ctx, Type *specialization, Typ
e->type = t_e->type;
}
} else {
- bool ok = is_polymorphic_type_assignable(ctx, st, tt, true, modify_type);
+ if (st->kind == Type_Basic && tt->kind == Type_Basic &&
+ s_e->kind == Entity_Constant && t_e->kind == Entity_Constant) {
+ if (!compare_exact_values(Token_CmpEq, s_e->Constant.value, t_e->Constant.value))
+ return false;
+ } else {
+ bool ok = is_polymorphic_type_assignable(ctx, st, tt, true, modify_type);
+ }
}
}